aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-04-09 18:25:22 +0800
committerPo Lu2022-04-09 18:26:19 +0800
commit40c2bfdae198100a4be3a8b25e0722fd7c953516 (patch)
tree75ed4a3f29623d371233cc36bd0da7a05a3b0c80 /src
parentd327fd594da7d7207c2d47414a6c47ff0c0e2598 (diff)
downloademacs-40c2bfdae198100a4be3a8b25e0722fd7c953516.tar.gz
emacs-40c2bfdae198100a4be3a8b25e0722fd7c953516.zip
Avoid sync when allowing touch events in handle_one_xevent
* src/xterm.c (handle_one_xevent): Don't catch errors around XIAllowTouchEvents. (x_error_handler): Ignore Device errors here instead.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/xterm.c b/src/xterm.c
index f6138d52144..0a2c3c58634 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -17948,10 +17948,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
17948 if (f && device->direct_p) 17948 if (f && device->direct_p)
17949 { 17949 {
17950 *finish = X_EVENT_DROP; 17950 *finish = X_EVENT_DROP;
17951 x_catch_errors (dpyinfo->display);
17952 if (x_input_grab_touch_events) 17951 if (x_input_grab_touch_events)
17953 XIAllowTouchEvents (dpyinfo->display, xev->deviceid, 17952 XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
17954 xev->detail, xev->event, XIAcceptTouch); 17953 xev->detail, xev->event, XIAcceptTouch);
17954
17955 if (!x_had_errors_p (dpyinfo->display)) 17955 if (!x_had_errors_p (dpyinfo->display))
17956 { 17956 {
17957 xi_link_touch_point (device, xev->detail, xev->event_x, 17957 xi_link_touch_point (device, xev->detail, xev->event_x,
@@ -17967,17 +17967,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
17967 if (source) 17967 if (source)
17968 inev.ie.device = source->name; 17968 inev.ie.device = source->name;
17969 } 17969 }
17970 x_uncatch_errors_after_check ();
17971 } 17970 }
17972#ifndef HAVE_GTK3 17971#ifndef HAVE_GTK3
17973 else 17972 else if (x_input_grab_touch_events)
17974 { 17973 XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
17975 x_catch_errors (dpyinfo->display); 17974 xev->detail, xev->event, XIRejectTouch);
17976 if (x_input_grab_touch_events)
17977 XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
17978 xev->detail, xev->event, XIRejectTouch);
17979 x_uncatch_errors ();
17980 }
17981#endif 17975#endif
17982 } 17976 }
17983 else 17977 else
@@ -19377,11 +19371,15 @@ x_error_handler (Display *display, XErrorEvent *event)
19377#ifdef HAVE_XINPUT2 19371#ifdef HAVE_XINPUT2
19378 dpyinfo = x_display_info_for_display (display); 19372 dpyinfo = x_display_info_for_display (display);
19379 19373
19380 /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice. */ 19374 /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice.
19375
19376 53 is X_XIAllowEvents. We handle errors from that here to avoid
19377 a sync in handle_one_xevent. */
19381 if (dpyinfo && dpyinfo->supports_xi2 19378 if (dpyinfo && dpyinfo->supports_xi2
19382 && event->request_code == dpyinfo->xi2_opcode 19379 && event->request_code == dpyinfo->xi2_opcode
19383 && (event->minor_code == 51 19380 && (event->minor_code == 51
19384 || event->minor_code == 52)) 19381 || event->minor_code == 52
19382 || event->minor_code == 53))
19385 return 0; 19383 return 0;
19386#endif 19384#endif
19387 19385