From: Andrey Listopadov <andreyorst@gmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: Yuuki Harano <masm+emacs@masm11.me>, 52685@debbugs.gnu.org
Subject: bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
Date: Wed, 22 Dec 2021 11:14:51 +0300 [thread overview]
Message-ID: <CAAKhXoZfcMfGGj_R0TzjSovcgK9cygj11vHGUvVgPngREyecMA@mail.gmail.com> (raw)
In-Reply-To: <87v8zhqidm.fsf@yahoo.com>
On Wed, Dec 22, 2021 at 9:11 AM Po Lu <luangruo@yahoo.com> wrote:
>
> Andrey Listopadov <andreyorst@gmail.com> writes:
>
> > On Wed, Dec 22, 2021 at 4:09 AM Po Lu <luangruo@yahoo.com> wrote:
> >>
> >> Po Lu <luangruo@yahoo.com> writes:
> >>
> >> > Andrey Listopadov <andreyorst@gmail.com> writes:
> >> >
> >> >> When `pixel-scroll-precision-mode' is disabled everything works fine.
> >> >> When compiled without `--with-pgtk' but with `--with-xinput2'
> >> >> `pixel-scroll-precision-mode' works as expected.
> >> >
> >> > Thanks, I will look into this now.
> >>
> >> Please try the following patch to see if it resolves your problem.
> >> Thanks.
> >>
> >> diff --git a/src/pgtkterm.c b/src/pgtkterm.c
> >> index bd61c65edd..bea2650584 100644
> >> --- a/src/pgtkterm.c
> >> +++ b/src/pgtkterm.c
> >> @@ -6133,78 +6133,64 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
> >> }
> >> else if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y))
> >> {
> >> - dpyinfo->scroll.acc_x += delta_x;
> >> - dpyinfo->scroll.acc_y += delta_y;
> >> - if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line
> >> - || !mwheel_coalesce_scroll_events)
> >> + if (!mwheel_coalesce_scroll_events)
> >> {
> >> - int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> - inev.ie.kind = WHEEL_EVENT;
> >> - inev.ie.modifiers |= down_modifier;
> >> - inev.ie.arg = list3 (make_fixnum (nlines),
> >> - make_float (-dpyinfo->scroll.acc_x * 100),
> >> - make_float (-dpyinfo->scroll.acc_y * 100));
> >> - if (!mwheel_coalesce_scroll_events)
> >> - {
> >> - dpyinfo->scroll.acc_y = 0;
> >> - dpyinfo->scroll.acc_x = 0;
> >> - }
> >> - else
> >> + inev.ie.kind = ((fabs (delta_x) > fabs (delta_y))
> >> + ? HORIZ_WHEEL_EVENT
> >> + : WHEEL_EVENT);
> >> + inev.ie.modifiers = (inev.ie.kind == HORIZ_WHEEL_EVENT
> >> + ? (delta_x >= 0 ? down_modifier : up_modifier)
> >> + : (delta_y >= 0 ? down_modifier : up_modifier));
> >> + inev.ie.arg = list3 (Qnil, make_float (delta_x),
> >> + make_float (delta_y));
> >> + }
> >> + else
> >> + {
> >> + dpyinfo->scroll.acc_x += delta_x;
> >> + dpyinfo->scroll.acc_y += delta_y;
> >> + if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line)
> >> {
> >> + int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> + inev.ie.kind = WHEEL_EVENT;
> >> + inev.ie.modifiers |= down_modifier;
> >> + inev.ie.arg = list3 (make_fixnum (nlines),
> >> + make_float (-dpyinfo->scroll.acc_x * 100),
> >> + make_float (-dpyinfo->scroll.acc_y * 100));
> >> dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines;
> >> }
> >> - }
> >> - else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line
> >> - || !mwheel_coalesce_scroll_events)
> >> - {
> >> - int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> - inev.ie.kind = WHEEL_EVENT;
> >> - inev.ie.modifiers |= up_modifier;
> >> - inev.ie.arg = list3 (make_fixnum (nlines),
> >> - make_float (-dpyinfo->scroll.acc_x * 100),
> >> - make_float (-dpyinfo->scroll.acc_y * 100));
> >> -
> >> - if (!mwheel_coalesce_scroll_events)
> >> + else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line)
> >> {
> >> - dpyinfo->scroll.acc_y = 0;
> >> - dpyinfo->scroll.acc_x = 0;
> >> + int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> + inev.ie.kind = WHEEL_EVENT;
> >> + inev.ie.modifiers |= up_modifier;
> >> + inev.ie.arg = list3 (make_fixnum (nlines),
> >> + make_float (-dpyinfo->scroll.acc_x * 100),
> >> + make_float (-dpyinfo->scroll.acc_y * 100));
> >> +
> >> + dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
> >> }
> >> - else
> >> - dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
> >> - }
> >> - else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
> >> - || !mwheel_coalesce_scroll_events)
> >> - {
> >> - int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> - inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> - inev.ie.modifiers |= up_modifier;
> >> - inev.ie.arg = list3 (make_fixnum (nchars),
> >> - make_float (-dpyinfo->scroll.acc_x * 100),
> >> - make_float (-dpyinfo->scroll.acc_y * 100));
> >> -
> >> - if (mwheel_coalesce_scroll_events)
> >> - dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
> >> - else
> >> + else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
> >> + || !mwheel_coalesce_scroll_events)
> >> {
> >> - dpyinfo->scroll.acc_x = 0;
> >> - dpyinfo->scroll.acc_y = 0;
> >> + int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> + inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> + inev.ie.modifiers |= up_modifier;
> >> + inev.ie.arg = list3 (make_fixnum (nchars),
> >> + make_float (-dpyinfo->scroll.acc_x * 100),
> >> + make_float (-dpyinfo->scroll.acc_y * 100));
> >> +
> >> + dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
> >> }
> >> - }
> >> - else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
> >> - {
> >> - int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> - inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> - inev.ie.modifiers |= down_modifier;
> >> - inev.ie.arg = list3 (make_fixnum (nchars),
> >> - make_float (-dpyinfo->scroll.acc_x * 100),
> >> - make_float (-dpyinfo->scroll.acc_y * 100));
> >> -
> >> - if (mwheel_coalesce_scroll_events)
> >> - dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
> >> - else
> >> + else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
> >> {
> >> - dpyinfo->scroll.acc_x = 0;
> >> - dpyinfo->scroll.acc_y = 0;
> >> + int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> + inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> + inev.ie.modifiers |= down_modifier;
> >> + inev.ie.arg = list3 (make_fixnum (nchars),
> >> + make_float (-dpyinfo->scroll.acc_x * 100),
> >> + make_float (-dpyinfo->scroll.acc_y * 100));
> >> +
> >> + dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
> >> }
> >> }
> >> }
>
> > The patch doesn't apply.
>
> That's odd. Could you try updating your checkout, or failing that,
> applying it manually?
>
> Thanks.
>
Sorry, seems the mail got corrupted the first time I tried.
I've applied the patch, and now horizontal scrolling works correctly.
However, pressing Ctrl while scrolling doesn't register as `C-' event.
With `pixel-scroll-precision-mode` off, if I press C-h k and scroll in
any direction with the Ctrl key held down I get this:
There were several key-sequences:
C-<wheel-up> at that spot runs the command mouse-wheel-text-scale
C-<wheel-down> at that spot runs the command mouse-wheel-text-scale
(Since C-<wheel-left> and C-<wheel-right> aren't mapped to anything
they're not in the list)
With `pixel-scroll-precision-mode` on I get:
There were several key-sequences:
<wheel-up> at that spot runs the command pixel-scroll-precision
<wheel-down> at that spot runs the command pixel-scroll-precision
<wheel-right> at that spot runs the command mwheel-scroll
<wheel-left> at that spot runs the command mwheel-scroll
<touch-end> runs the command pixel-scroll-start-momentum
So the scrolling works, but the Ctrl key is ignored now. The same
happens with other modifier keys.
--
Andrey Listopadov
next prev parent reply other threads:[~2021-12-22 8:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-20 20:42 bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk Andrey Listopadov
2021-12-21 1:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21 7:22 ` Andrey Listopadov
2021-12-21 7:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21 13:28 ` Yuuki Harano
2021-12-21 13:54 ` Andrey Listopadov
2021-12-22 1:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 1:09 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 5:55 ` Andrey Listopadov
2021-12-22 6:11 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 8:14 ` Andrey Listopadov [this message]
2021-12-22 9:29 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 13:24 ` Andrey Listopadov
2021-12-22 13:26 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 13:33 ` Andrey Listopadov
2021-12-22 13:36 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 13:48 ` Andrey Listopadov
2022-01-10 18:40 ` Andrey Listopadov
2022-01-11 0:54 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11 4:16 ` Andrey Listopadov
2022-01-11 4:22 ` Andrey Listopadov
2022-01-11 4:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11 5:39 ` Andrey Listopadov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAKhXoZfcMfGGj_R0TzjSovcgK9cygj11vHGUvVgPngREyecMA@mail.gmail.com \
--to=andreyorst@gmail.com \
--cc=52685@debbugs.gnu.org \
--cc=luangruo@yahoo.com \
--cc=masm+emacs@masm11.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).