unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Urban Duh <urby.duh@gmail.com>
Cc: 54436@debbugs.gnu.org
Subject: bug#54436: 28.0.91; Only every second mouse wheel scroll is registered
Date: Sat, 19 Mar 2022 08:52:43 +0800	[thread overview]
Message-ID: <87ee2yn4pw.fsf@yahoo.com> (raw)
In-Reply-To: <CAC4YYwbv09_POqdHzNAGb3bTxV3PF2Jhxq6n-jdqo+hG9b7Z=A@mail.gmail.com> (Urban Duh's message of "Thu, 17 Mar 2022 11:47:50 +0100")

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	other threads:[~2022-03-19  0:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 10:47 bug#54436: 28.0.91; Only every second mouse wheel scroll is registered Urban Duh
2022-03-19  0:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-03-19 14:18   ` Lars Ingebrigtsen
2022-03-20 16:55     ` Urban Duh
2022-03-21  2:13       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-21  9:20         ` Urban Duh
2022-03-21 11:05           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-22 13:59             ` Urban Duh

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=87ee2yn4pw.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=54436@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=urby.duh@gmail.com \
    /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).