From: Po Lu Date: Sat, 9 Apr 2022 10:25:22 +0000 (+0800) Subject: Avoid sync when allowing touch events in handle_one_xevent X-Git-Tag: emacs-29.0.90~1931^2~685 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=40c2bfdae198100a4be3a8b25e0722fd7c953516;p=emacs.git 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. --- 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, if (f && device->direct_p) { *finish = X_EVENT_DROP; - x_catch_errors (dpyinfo->display); if (x_input_grab_touch_events) XIAllowTouchEvents (dpyinfo->display, xev->deviceid, xev->detail, xev->event, XIAcceptTouch); + if (!x_had_errors_p (dpyinfo->display)) { xi_link_touch_point (device, xev->detail, xev->event_x, @@ -17967,17 +17967,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (source) inev.ie.device = source->name; } - x_uncatch_errors_after_check (); } #ifndef HAVE_GTK3 - else - { - x_catch_errors (dpyinfo->display); - if (x_input_grab_touch_events) - XIAllowTouchEvents (dpyinfo->display, xev->deviceid, - xev->detail, xev->event, XIRejectTouch); - x_uncatch_errors (); - } + else if (x_input_grab_touch_events) + XIAllowTouchEvents (dpyinfo->display, xev->deviceid, + xev->detail, xev->event, XIRejectTouch); #endif } else @@ -19377,11 +19371,15 @@ x_error_handler (Display *display, XErrorEvent *event) #ifdef HAVE_XINPUT2 dpyinfo = x_display_info_for_display (display); - /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice. */ + /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice. + + 53 is X_XIAllowEvents. We handle errors from that here to avoid + a sync in handle_one_xevent. */ if (dpyinfo && dpyinfo->supports_xi2 && event->request_code == dpyinfo->xi2_opcode && (event->minor_code == 51 - || event->minor_code == 52)) + || event->minor_code == 52 + || event->minor_code == 53)) return 0; #endif