emacs-diffs
[Top][All Lists]
Advanced

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

master a0fbdb5166: Improve XI2 valuator reset logic


From: Po Lu
Subject: master a0fbdb5166: Improve XI2 valuator reset logic
Date: Wed, 26 Jan 2022 21:04:29 -0500 (EST)

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

    Improve XI2 valuator reset logic
    
    * src/xterm.c (handle_one_xevent): Clear valuators on XI_Leave
    instead of XI_Enter.
---
 src/xterm.c | 43 +++++++++++++++++--------------------------
 1 file changed, 17 insertions(+), 26 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index d52d7311bb..30a3aee20e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10390,32 +10390,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
            {
 #ifdef HAVE_XWIDGETS
              struct xwidget_view *xwidget_view = xwidget_view_from_window 
(enter->event);
-#else
-             bool xwidget_view = false;
-#endif
-
-             /* One problem behind the design of XInput 2 scrolling is
-                that valuators are not unique to each window, but only
-                the window that has grabbed the valuator's device or
-                the window that the device's pointer is on top of can
-                receive motion events.  There is also no way to
-                retrieve the value of a valuator outside of each motion
-                event.
-
-                As such, to prevent wildly inaccurate results when the
-                valuators have changed outside Emacs, we reset our
-                records of each valuator's value whenever the pointer
-                re-enters a frame after its valuators have potentially
-                been changed elsewhere.  */
-             if (enter->detail != XINotifyInferior
-                 && enter->mode != XINotifyPassiveUngrab
-                 /* See the comment under FocusIn in
-                    `x_detect_focus_change'.  The main relevant culprit
-                    these days seems to be XFCE.  */
-                 && enter->mode != XINotifyUngrab
-                 && (xwidget_view
-                     || (any && enter->event == FRAME_X_WINDOW (any))))
-               xi_reset_scroll_valuators_for_device_id (dpyinfo, 
enter->deviceid);
+#endif
 
 #ifdef HAVE_XWIDGETS
              if (xwidget_view)
@@ -10457,6 +10432,22 @@ handle_one_xevent (struct x_display_info *dpyinfo,
            ev.window = leave->event;
            any = x_top_window_to_frame (dpyinfo, leave->event);
 
+           /* One problem behind the design of XInput 2 scrolling is
+              that valuators are not unique to each window, but only
+              the window that has grabbed the valuator's device or
+              the window that the device's pointer is on top of can
+              receive motion events.  There is also no way to
+              retrieve the value of a valuator outside of each motion
+              event.
+
+              As such, to prevent wildly inaccurate results when the
+              valuators have changed outside Emacs, we reset our
+              records of each valuator's value whenever the pointer
+              moves out of a frame (and not into one of its
+              children, which we know about).  */
+           if (leave->detail != XINotifyInferior && any)
+             xi_reset_scroll_valuators_for_device_id (dpyinfo, 
enter->deviceid);
+
 #ifdef HAVE_XWIDGETS
            {
              struct xwidget_view *xvw



reply via email to

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