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

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Mon, 29 Jan 2024 14:46:01 UTC

Severity: wishlist

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 68796 <at> debbugs.gnu.org
Subject: bug#68796: Stefan's wheel event change
Date: Fri, 05 Apr 2024 17:22:05 -0400
>> +** Mouse wheel events should now always be 'wheel-up/down/left/right'.
>> +At those places where the old 'mouse-4/5/6/7' events could still occur
>> +(i.e. X11 input in the absence of XInput2, and `xterm-mouse-mode`),
>> +we remap them to the corresponding 'wheel-up/down/left/right' event,
>> +according to the new variable 'mouse-wheel-buttons'.
>
> Likewise here.

Fixed.

>> +(defcustom mouse-wheel-buttons
>> +  '((4 . wheel-up) (5 . wheel-down) (6 . wheel-left) (7 . wheel-right))
>> +  "Buttons to remap to wheel events.
>
> Suggest to rephrase:
>
>   "How to remap mouse button numbers to wheel events."

Thanks.

>> +This is an alist of (NUMBER . SYMBOL) used to remap old-style mouse wheel
>> +events represented as mouse button events.  It remaps mouse button event
>> +NUMBER to the event SYMBOL.  SYMBOL must be one of `wheel-up', `wheel-down',
>
> Not "mouse event NUMBER", but "mouse button NUMBER", I think.
> Alternatively, you could say "mouse button event 'mouse-NUMBER'".
> IOW, NUMBER is not a mouse event, it's a number.

Indeed.

>> +  /* Convert pre-XInput2 wheel events represented as mouse-clicks.  */
>> +  if (!xi2)
>> +    {
>> +      Lisp_Object base
>> +        = Fcdr_safe (Fassq (make_fixnum (result->code + 1),
>> +                            Fsymbol_value (Qmouse_wheel_buttons)));
>
> Should this test mouse-wheel-buttons for being bound and have a list
> value, before calling assq?  mouse.el is preloaded relatively late in
> loadup, so I think we had better played it safe, no?

AFAIK we can't get such events until *much* later, after the dump, so
I don't see any need for that.  Especially since it only affects mouse
clicks, so it wouldn't render Emacs unusable.

`Fassq` can also signal an error if `mouse-wheel-buttons` contains
something else than an alist, but in my tests, this simply results in
error messages when you use the mouse buttons/wheel, which is about as
good as it gets, IMO.


        Stefan





This bug report was last modified 1 year and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.