]> git.eshelyaron.com Git - emacs.git/commitdiff
Ignore input extension errors caused by grabbing
authorPo Lu <luangruo@yahoo.com>
Fri, 8 Apr 2022 03:22:06 +0000 (11:22 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 8 Apr 2022 03:22:06 +0000 (11:22 +0800)
* src/xterm.c (x_error_handler): Ignore GrabDevice and
UngrabDevice errors.

src/xterm.c

index 9336b9420f64bd020ceb831a8b5b188a85c5016f..9b0fe6f3f7b6bad570bc26cceb611956e0d6267c 100644 (file)
@@ -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