bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54436: 28.0.91; Only every second mouse wheel scroll is registered


From: Po Lu
Subject: bug#54436: 28.0.91; Only every second mouse wheel scroll is registered
Date: Sat, 19 Mar 2022 08:52:43 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Urban Duh <urby.duh@gmail.com> writes:

> Only every second mouse wheel scroll move is registered, instead of all of
> them. This happens when scrolling the text and also when using
> keybindings (i. e. C-h <wheel-up> is activated only after scrolling
> twice). The two scrolls do not need to be in quick succession, I can
> scroll once (and nothing happens), wait for a long time and then the
> next scroll is registered.
>
> Currently using Doom Emacs on Emacs 28.0.91 with native compilation on
> Arch Linux running GNOME on Xorg, but the same thing can be reproduced
> in Emacs 29.0.50, on Wayland and in other WMs (I tried Qtile). The same
> issue exists on Emacs without any customizations (just installing
> emacs-git or emacs-gcc-wayland-devel-bin from AUR without Doom). Emacs
> 27 (package emacs from Arch Extra repository) does not have this issue
> and works fine.
>
> I am new to Emacs, so I'm not completely sure what other info I should
> provide, so do not hesitate to contact me for more info.

Are you running PGTK?  It's not present in the official pretests of
Emacs 28, but several very irresponsible individuals are haphazardly
merging the code from Emacs 29 into Emacs 28, and then distributing
packages labeled "enhanced or "wayland" on platforms such as the AUR.

If you're running X, don't use PGTK.  Here's the problem in this
specific case: GTK uses the X input extension to detect mouse wheel
movement, which relies on keeping the mouse wheel "valuators" in synch
with the X server, and calculating the difference between GTK's own
record of the valuator values and the X server's reported values every
time a valuator changes.

This is made complicated by the fact that an X window does not get
events to update the valuators unless it has the grab, or the mouse
pointer is on top of it.

So, every time the mouse enters a window, GTK marks the valuator as
invalid, after which two consecutive wheel events are required before
any more wheel movement will be recorded: one to obtain the current
value of the valuator, and another one so that the distance the wheel
has moved can be calculated.

Selecting for input extension events results in the corresponding core
event mask being deactivated on the window.  Some very smart window
managers select for core wheel events (which are just button events) on
the WM frame window, or the root window, and since there is no core
button event mask on the Emacs frame window when GTK is using the input
extension, the button events representing wheel movement get propagated
up to the frame (or root) window, and that causes a grab to be activated
and then deactivated, generating incorrect entry events, which then
cause GTK to invalidate its own record of the scroll valuators, and
causes wheel movement to be ignored at random.

The solution is to use the official build of Emacs 28, and to not use
PGTK on X Windows if you want to run Emacs 29.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]