1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-14 07:20:35 -08:00

Ignore input extension errors caused by grabbing

* src/xterm.c (x_error_handler): Ignore GrabDevice and
UngrabDevice errors.
This commit is contained in:
Po Lu 2022-04-08 11:22:06 +08:00
parent 598d1a2aa3
commit c42ef4e7c1

View 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