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: Po Lu <luangruo <at> yahoo.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 68796 <at> debbugs.gnu.org
Subject: bug#68796: xterm.c: Convert mouse-4/5/6/7 to wheel-up/down/left/right
Date: Sun, 03 Mar 2024 22:07:40 -0500
> That would be simple if I could find the FIXME, but it doesn't appear to
> be present anywhere in that patch...

[ Hmm... not sure what happened: `C-s FIXME` finds it for me:  ]

diff --git a/src/keyboard.c b/src/keyboard.c
index 1f7253a7da1..4c3e33762af 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6628,8 +6628,13 @@ make_lispy_event (struct input_event *event)
 
 	if (CONSP (event->arg))
 	  return list5 (head, position, make_fixnum (double_click_count),
-			XCAR (event->arg), Fcons (XCAR (XCDR (event->arg)),
-						  XCAR (XCDR (XCDR (event->arg)))));
+			XCAR (event->arg),
+			/* FIXME: I don't know what I'm doing here.  */
+			(CONSP (XCDR (event->arg))
+			 && CONSP (XCDR (XCDR (event->arg))))
+			? Fcons (XCAR (XCDR (event->arg)),
+			         XCAR (XCDR (XCDR (event->arg))))
+			: Qnil);
         else if (NUMBERP (event->arg))
           return list4 (head, position, make_fixnum (double_click_count),
                         event->arg);

>>> +  /* 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)));
>>> +      int wheel
>>> +        = NILP (base) ? -1
>>> +          : BASE_EQ (base, Qwheel_down)  ? 0
>>> +          : BASE_EQ (base, Qwheel_up)    ? 1
>>> +          : BASE_EQ (base, Qwheel_left)  ? 2
>>> +          : BASE_EQ (base, Qwheel_right) ? 3
>>> +          : -1;
>
> This should be surrounded by parentheses.

Ah, it might be need for CC-mode, indeed, thanks.
`sm-c-mode` gets this right without the parens :-)


        Stefan





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

Previous Next


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