From 5bedef8f87d2103e21342a06c4c1c9d7efe06621 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 31 Aug 2022 09:44:13 +0800 Subject: [PATCH] Fix bug#57476 * src/xterm.c (handle_one_xevent): Don't reset valuators on certain crossing events, for the benefit of xfwm4. (bug#57476) --- src/xterm.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index e0a8e13b24e..3c05bc7807d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -20771,8 +20771,20 @@ handle_one_xevent (struct x_display_info *dpyinfo, any = x_any_window_to_frame (dpyinfo, enter->event); #ifdef HAVE_XINPUT2_1 - xi_reset_scroll_valuators_for_device_id (dpyinfo, enter->deviceid, - true); + /* 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 (enter->mode != XINotifyUngrab + && enter->mode != XINotifyGrab + && enter->mode != XINotifyPassiveGrab + && enter->mode != XINotifyPassiveUngrab) + xi_reset_scroll_valuators_for_device_id (dpyinfo, enter->deviceid, + true); #endif { @@ -20888,7 +20900,20 @@ handle_one_xevent (struct x_display_info *dpyinfo, moves out of a frame (and not into one of its children, which we know about). */ #ifdef HAVE_XINPUT2_1 - if (leave->detail != XINotifyInferior && any) + if (leave->detail != XINotifyInferior && 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 + && leave->mode != XINotifyGrab + && leave->mode != XINotifyPassiveUngrab + && leave->mode != XINotifyPassiveGrab) xi_reset_scroll_valuators_for_device_id (dpyinfo, leave->deviceid, false); #endif -- 2.39.2