diff options
| author | Po Lu | 2022-04-08 11:22:06 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-08 11:22:06 +0800 |
| commit | c42ef4e7c142a93e2ccfea904d72735a6030e978 (patch) | |
| tree | 7d901c4539771f131ac6ee2e0b3342579518d2e8 | |
| parent | 598d1a2aa3ffdbc6de3e28797faf3ff68e0475f9 (diff) | |
| download | emacs-c42ef4e7c142a93e2ccfea904d72735a6030e978.tar.gz emacs-c42ef4e7c142a93e2ccfea904d72735a6030e978.zip | |
Ignore input extension errors caused by grabbing
* src/xterm.c (x_error_handler): Ignore GrabDevice and
UngrabDevice errors.
| -rw-r--r-- | src/xterm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index 9336b9420f6..9b0fe6f3f7b 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -19200,6 +19200,10 @@ static void x_error_quitter (Display *, XErrorEvent *); | |||
| 19200 | static int | 19200 | static int |
| 19201 | x_error_handler (Display *display, XErrorEvent *event) | 19201 | x_error_handler (Display *display, XErrorEvent *event) |
| 19202 | { | 19202 | { |
| 19203 | #ifdef HAVE_XINPUT2 | ||
| 19204 | struct x_display_info *dpyinfo; | ||
| 19205 | #endif | ||
| 19206 | |||
| 19203 | #if defined USE_GTK && defined HAVE_GTK3 | 19207 | #if defined USE_GTK && defined HAVE_GTK3 |
| 19204 | if ((event->error_code == BadMatch || event->error_code == BadWindow) | 19208 | if ((event->error_code == BadMatch || event->error_code == BadWindow) |
| 19205 | && event->request_code == X_SetInputFocus) | 19209 | && event->request_code == X_SetInputFocus) |
| @@ -19208,6 +19212,20 @@ x_error_handler (Display *display, XErrorEvent *event) | |||
| 19208 | } | 19212 | } |
| 19209 | #endif | 19213 | #endif |
| 19210 | 19214 | ||
| 19215 | /* If we try to ungrab or grab a device that doesn't exist anymore | ||
| 19216 | (that happens a lot in xmenu.c), just ignore the error. */ | ||
| 19217 | |||
| 19218 | #ifdef HAVE_XINPUT2 | ||
| 19219 | dpyinfo = x_display_info_for_display (display); | ||
| 19220 | |||
| 19221 | /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice. */ | ||
| 19222 | if (dpyinfo && dpyinfo->supports_xi2 | ||
| 19223 | && event->request_code == dpyinfo->xi2_opcode | ||
| 19224 | && (event->minor_code == 51 | ||
| 19225 | || event->minor_code == 52)) | ||
| 19226 | return 0; | ||
| 19227 | #endif | ||
| 19228 | |||
| 19211 | if (x_error_message) | 19229 | if (x_error_message) |
| 19212 | x_error_catcher (display, event); | 19230 | x_error_catcher (display, event); |
| 19213 | else | 19231 | else |