emacs-diffs
[Top][All Lists]
Advanced

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

master eb8478c514: Further simplify valuator reset code


From: Po Lu
Subject: master eb8478c514: Further simplify valuator reset code
Date: Thu, 3 Nov 2022 07:27:46 -0400 (EDT)

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

    Further simplify valuator reset code
    
    * src/xterm.c (xi_reset_scroll_valuators_for_device_id): Minor
    style adjustments.
    (handle_one_xevent): Don't check frames; reset on all XI_Enter
    and XI_Leave events.
---
 src/xterm.c | 42 ++++++++++++++++--------------------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 17ff35a671..1b666fae7e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5610,8 +5610,11 @@ static void
 xi_reset_scroll_valuators_for_device_id (struct x_display_info *dpyinfo,
                                         int id)
 {
-  struct xi_device_t *device = xi_device_from_id (dpyinfo, id);
+  struct xi_device_t *device;
   struct xi_scroll_valuator_t *valuator;
+  int i;
+
+  device = xi_device_from_id (dpyinfo, id);
 
   if (!device)
     return;
@@ -5619,7 +5622,7 @@ xi_reset_scroll_valuators_for_device_id (struct 
x_display_info *dpyinfo,
   if (!device->scroll_valuator_count)
     return;
 
-  for (int i = 0; i < device->scroll_valuator_count; ++i)
+  for (i = 0; i < device->scroll_valuator_count; ++i)
     {
       valuator = &device->valuators[i];
       valuator->invalid_p = true;
@@ -21399,6 +21402,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                 related to those grabs arrive.  The only way to
                 remedy this is to never reset scroll valuators on a
                 grab-related crossing event.  (bug#57476) */
+
              if (enter->mode != XINotifyUngrab
                  && enter->mode != XINotifyGrab
                  && enter->mode != XINotifyPassiveGrab
@@ -21528,17 +21532,16 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                 was very complicated and kept running into server
                 bugs.  */
 #ifdef HAVE_XINPUT2_1
-             if (any
-                 /* xfwm4 selects for button events on the frame
-                    window, resulting in passive grabs being
-                    generated along with the delivery of emulated
-                    button events; this then interferes with
-                    scrolling, since device valuators will constantly
-                    be reset as the crossing events related to those
-                    grabs arrive.  The only way to remedy this is to
-                    never reset scroll valuators on a grab-related
-                    crossing event.  (bug#57476) */
-                 && leave->mode != XINotifyUngrab
+             /* xfwm4 selects for button events on the frame window,
+                resulting in passive grabs being generated along with
+                the delivery of emulated button events; this then
+                interferes with scrolling, since device valuators
+                will constantly be reset as the crossing events
+                related to those grabs arrive.  The only way to
+                remedy this is to never reset scroll valuators on a
+                grab-related crossing event.  (bug#57476) */
+
+             if (leave->mode != XINotifyUngrab
                  && leave->mode != XINotifyGrab
                  && leave->mode != XINotifyPassiveUngrab
                  && leave->mode != XINotifyPassiveGrab)
@@ -21575,19 +21578,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                 masks are set on the frame widget's window.  */
              f = x_window_to_frame (dpyinfo, leave->event);
 
-             /* Also do this again here, since the test for `any'
-                above may not have found a frame, as that usually
-                just looks up a top window on Xt builds.  */
-
-#ifdef HAVE_XINPUT2_1
-             if (f && leave->mode != XINotifyUngrab
-                 && leave->mode != XINotifyGrab
-                 && leave->mode != XINotifyPassiveUngrab
-                 && leave->mode != XINotifyPassiveGrab)
-               xi_reset_scroll_valuators_for_device_id (dpyinfo,
-                                                        leave->deviceid);
-#endif
-
              if (!f)
                f = x_top_window_to_frame (dpyinfo, leave->event);
 #endif



reply via email to

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