Subject: bug#68796: xterm.c: Convert mouse-4/5/6/7 to wheel-up/down/left/right

From: Stefan Monnier <[email-masked]>
Date: Sat, 10 Feb 2024 09:22:02 -0500

Po Lu [2024-02-10 17:09:14] wrote:
> Eli Zaretskii <[email-masked]> writes:
>> Ping!  Can we make some progress here?
> I converted most of the Lisp code at my organization (where X servers
> are configured with the input extension disabled) to use wheel events
> under Emacs 30 and arranged for a modified version of Stefan's patch to
> be built.  Which was incidentally not straightforward to do cleanly, as
> the code in question assumed that events it received would be pairs of
> button press and release events, and was very much designed around that
> assumption.

Fascinating.  Is there any way I could get to peek at that code?
Also interested in the backstory about why your X11 servers are configured
without XInput2.

Maybe we should provide a better "reverse" story: with the current patch
users can recover their old `mouse-4/5/6/7` events by setting
`mouse-wheel-*-event` to nil, but then they lose mwheel-based scrolling
(plus a few other bindings, mostly one in completion-preview and one in
flymake), so the etc/NEWS entry should describe how to recover that
scrolling behavior.

Or maybe we should keep `mouse-wheel-*-event` untouched (tho, maybe mark
them obsolete) and instead introduce a new set of variables that control
the remapping of `mouse-4/5/6/7` to `wheel-*` events.

That would provide a smoother transition: users can set those new vars
to nil to recover the old behavior.

Another benefit is that the new var(s) could hold just the button
numbers (i.e. an integer) instead of a symbol, which should simplify the
remapping code (both in the `xterm.c` and the `xt-mouse.el` cases).

        Stefan