emacs-diffs
[Top][All Lists]
Advanced

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

master c42ef4e7c1: Ignore input extension errors caused by grabbing


From: Po Lu
Subject: master c42ef4e7c1: Ignore input extension errors caused by grabbing
Date: Thu, 7 Apr 2022 23:22:36 -0400 (EDT)

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

    Ignore input extension errors caused by grabbing
    
    * src/xterm.c (x_error_handler): Ignore GrabDevice and
    UngrabDevice errors.
---
 src/xterm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index 9336b9420f..9b0fe6f3f7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -19200,6 +19200,10 @@ static void x_error_quitter (Display *, XErrorEvent *);
 static int
 x_error_handler (Display *display, XErrorEvent *event)
 {
+#ifdef HAVE_XINPUT2
+  struct x_display_info *dpyinfo;
+#endif
+
 #if defined USE_GTK && defined HAVE_GTK3
   if ((event->error_code == BadMatch || event->error_code == BadWindow)
       && event->request_code == X_SetInputFocus)
@@ -19208,6 +19212,20 @@ x_error_handler (Display *display, XErrorEvent *event)
     }
 #endif
 
+  /* If we try to ungrab or grab a device that doesn't exist anymore
+     (that happens a lot in xmenu.c), just ignore the error.  */
+
+#ifdef HAVE_XINPUT2
+  dpyinfo = x_display_info_for_display (display);
+
+  /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice.  */
+  if (dpyinfo && dpyinfo->supports_xi2
+      && event->request_code == dpyinfo->xi2_opcode
+      && (event->minor_code == 51
+         || event->minor_code == 52))
+    return 0;
+#endif
+
   if (x_error_message)
     x_error_catcher (display, event);
   else



reply via email to

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