aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-11-03 19:27:24 +0800
committerPo Lu2022-11-03 19:27:29 +0800
commiteb8478c5142c32efacb19e22c5203885393a423c (patch)
tree0678151d315eef6451429ab091f7636d5cadb187 /src
parentd16494cffbed79a916482558ae5ed1bdcc67c88d (diff)
downloademacs-eb8478c5142c32efacb19e22c5203885393a423c.tar.gz
emacs-eb8478c5142c32efacb19e22c5203885393a423c.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 17ff35a6712..1b666fae7e2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5610,8 +5610,11 @@ static void
5610xi_reset_scroll_valuators_for_device_id (struct x_display_info *dpyinfo, 5610xi_reset_scroll_valuators_for_device_id (struct x_display_info *dpyinfo,
5611 int id) 5611 int id)
5612{ 5612{
5613 struct xi_device_t *device = xi_device_from_id (dpyinfo, id); 5613 struct xi_device_t *device;
5614 struct xi_scroll_valuator_t *valuator; 5614 struct xi_scroll_valuator_t *valuator;
5615 int i;
5616
5617 device = xi_device_from_id (dpyinfo, id);
5615 5618
5616 if (!device) 5619 if (!device)
5617 return; 5620 return;
@@ -5619,7 +5622,7 @@ xi_reset_scroll_valuators_for_device_id (struct x_display_info *dpyinfo,
5619 if (!device->scroll_valuator_count) 5622 if (!device->scroll_valuator_count)
5620 return; 5623 return;
5621 5624
5622 for (int i = 0; i < device->scroll_valuator_count; ++i) 5625 for (i = 0; i < device->scroll_valuator_count; ++i)
5623 { 5626 {
5624 valuator = &device->valuators[i]; 5627 valuator = &device->valuators[i];
5625 valuator->invalid_p = true; 5628 valuator->invalid_p = true;
@@ -21399,6 +21402,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
21399 related to those grabs arrive. The only way to 21402 related to those grabs arrive. The only way to
21400 remedy this is to never reset scroll valuators on a 21403 remedy this is to never reset scroll valuators on a
21401 grab-related crossing event. (bug#57476) */ 21404 grab-related crossing event. (bug#57476) */
21405
21402 if (enter->mode != XINotifyUngrab 21406 if (enter->mode != XINotifyUngrab
21403 && enter->mode != XINotifyGrab 21407 && enter->mode != XINotifyGrab
21404 && enter->mode != XINotifyPassiveGrab 21408 && enter->mode != XINotifyPassiveGrab
@@ -21528,17 +21532,16 @@ handle_one_xevent (struct x_display_info *dpyinfo,
21528 was very complicated and kept running into server 21532 was very complicated and kept running into server
21529 bugs. */ 21533 bugs. */
21530#ifdef HAVE_XINPUT2_1 21534#ifdef HAVE_XINPUT2_1
21531 if (any 21535 /* xfwm4 selects for button events on the frame window,
21532 /* xfwm4 selects for button events on the frame 21536 resulting in passive grabs being generated along with
21533 window, resulting in passive grabs being 21537 the delivery of emulated button events; this then
21534 generated along with the delivery of emulated 21538 interferes with scrolling, since device valuators
21535 button events; this then interferes with 21539 will constantly be reset as the crossing events
21536 scrolling, since device valuators will constantly 21540 related to those grabs arrive. The only way to
21537 be reset as the crossing events related to those 21541 remedy this is to never reset scroll valuators on a
21538 grabs arrive. The only way to remedy this is to 21542 grab-related crossing event. (bug#57476) */
21539 never reset scroll valuators on a grab-related 21543
21540 crossing event. (bug#57476) */ 21544 if (leave->mode != XINotifyUngrab
21541 && leave->mode != XINotifyUngrab
21542 && leave->mode != XINotifyGrab 21545 && leave->mode != XINotifyGrab
21543 && leave->mode != XINotifyPassiveUngrab 21546 && leave->mode != XINotifyPassiveUngrab
21544 && leave->mode != XINotifyPassiveGrab) 21547 && leave->mode != XINotifyPassiveGrab)
@@ -21575,19 +21578,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
21575 masks are set on the frame widget's window. */ 21578 masks are set on the frame widget's window. */
21576 f = x_window_to_frame (dpyinfo, leave->event); 21579 f = x_window_to_frame (dpyinfo, leave->event);
21577 21580
21578 /* Also do this again here, since the test for `any'
21579 above may not have found a frame, as that usually
21580 just looks up a top window on Xt builds. */
21581
21582#ifdef HAVE_XINPUT2_1
21583 if (f && leave->mode != XINotifyUngrab
21584 && leave->mode != XINotifyGrab
21585 && leave->mode != XINotifyPassiveUngrab
21586 && leave->mode != XINotifyPassiveGrab)
21587 xi_reset_scroll_valuators_for_device_id (dpyinfo,
21588 leave->deviceid);
21589#endif
21590
21591 if (!f) 21581 if (!f)
21592 f = x_top_window_to_frame (dpyinfo, leave->event); 21582 f = x_top_window_to_frame (dpyinfo, leave->event);
21593#endif 21583#endif