emacs-diffs
[Top][All Lists]
Advanced

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

master 40c2bfdae1: Avoid sync when allowing touch events in handle_one_x


From: Po Lu
Subject: master 40c2bfdae1: Avoid sync when allowing touch events in handle_one_xevent
Date: Sat, 9 Apr 2022 06:26:51 -0400 (EDT)

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

    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.
---
 src/xterm.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index f6138d5214..0a2c3c5863 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
 



reply via email to

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