emacs-diffs
[Top][All Lists]
Advanced

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

master b305f5a3ab: Correctly process legacy XI wheel events on top of sc


From: Po Lu
Subject: master b305f5a3ab: Correctly process legacy XI wheel events on top of scroll bars
Date: Fri, 4 Mar 2022 01:18:02 -0500 (EST)

branch: master
commit b305f5a3ab96f828bb8b41a702758314b924139c
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Correctly process legacy XI wheel events on top of scroll bars
    
    * src/xterm.c (handle_one_xevent): Handle XI button events
    generated by scroll wheels on top of scroll bars.
---
 src/xterm.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index b9a4328c29..2c6289a9cb 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -12236,6 +12236,48 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                }
 
 #ifdef USE_GTK
+             if (!f)
+               {
+                 int real_x = lrint (xev->event_x);
+                 int real_y = lrint (xev->event_y);
+                 Window child;
+
+                 f = x_any_window_to_frame (dpyinfo, xev->event);
+
+                 if (xev->detail > 3 && xev->detail < 9 && f)
+                   {
+                     if (xev->evtype == XI_ButtonRelease)
+                       {
+                         if (FRAME_X_WINDOW (f) != xev->event)
+                           XTranslateCoordinates (dpyinfo->display, xev->event,
+                                                  FRAME_X_WINDOW (f), real_x,
+                                                  real_y, &real_x, &real_y, 
&child);
+
+                         if (xev->detail <= 5)
+                           inev.ie.kind = WHEEL_EVENT;
+                         else
+                           inev.ie.kind = HORIZ_WHEEL_EVENT;
+
+                         inev.ie.timestamp = xev->time;
+
+                         XSETINT (inev.ie.x, real_x);
+                         XSETINT (inev.ie.y, real_y);
+                         XSETFRAME (inev.ie.frame_or_window, f);
+
+                         inev.ie.modifiers
+                           |= x_x_to_emacs_modifiers (dpyinfo,
+                                                      xev->mods.effective);
+
+                         inev.ie.modifiers |= xev->detail % 2 ? down_modifier 
: up_modifier;
+                       }
+
+                     *finish = X_EVENT_DROP;
+                     goto XI_OTHER;
+                   }
+                 else
+                   f = NULL;
+               }
+
              if (f && xg_event_is_for_scrollbar (f, event, false))
                f = 0;
 #endif



reply via email to

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