diff options
| author | Po Lu | 2021-12-27 10:02:39 +0800 |
|---|---|---|
| committer | Po Lu | 2021-12-27 10:05:01 +0800 |
| commit | d9977018e045be002f2b48254215fda5f3a067fc (patch) | |
| tree | 4506aad3d6645682d7b1f5af1dc969bc866a6663 /src | |
| parent | 2ccb1568876f6ac7d8b980d60d91a689e797ab36 (diff) | |
| download | emacs-d9977018e045be002f2b48254215fda5f3a067fc.tar.gz emacs-d9977018e045be002f2b48254215fda5f3a067fc.zip | |
Fix menu window persistence and entry/leave events on Lucid on XI2
* src/xmenu.c (x_activate_menubar): Always clear the XI2 grab on
Xt.
* src/xterm.c (handle_one_xevent): On XI2, ignore LeaveNotify
events coming from the shell widget and use `x_window_to_frame'
to find the frame when handling XI_Leave events.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xmenu.c | 9 | ||||
| -rw-r--r-- | src/xterm.c | 13 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 9b0353f133f..f3b7c45ffff 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -448,11 +448,11 @@ x_activate_menubar (struct frame *f) | |||
| 448 | XPutBackEvent (f->output_data.x->display_info->display, | 448 | XPutBackEvent (f->output_data.x->display_info->display, |
| 449 | f->output_data.x->saved_menu_event); | 449 | f->output_data.x->saved_menu_event); |
| 450 | #else | 450 | #else |
| 451 | #ifdef USE_MOTIF | 451 | #if defined USE_X_TOOLKIT && defined HAVE_XINPUT2 |
| 452 | #ifdef HAVE_XINPUT2 | ||
| 453 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 452 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 454 | /* Clear the XI2 grab so Motif can set a core grab. Otherwise some | 453 | /* Clear the XI2 grab so Motif or lwlib can set a core grab. |
| 455 | versions of Motif will emit a warning and hang. */ | 454 | Otherwise some versions of Motif will emit a warning and hang, |
| 455 | and lwlib will fail to destroy the menu window. */ | ||
| 456 | 456 | ||
| 457 | if (dpyinfo->num_devices) | 457 | if (dpyinfo->num_devices) |
| 458 | { | 458 | { |
| @@ -461,7 +461,6 @@ x_activate_menubar (struct frame *f) | |||
| 461 | CurrentTime); | 461 | CurrentTime); |
| 462 | } | 462 | } |
| 463 | #endif | 463 | #endif |
| 464 | #endif | ||
| 465 | XtDispatchEvent (f->output_data.x->saved_menu_event); | 464 | XtDispatchEvent (f->output_data.x->saved_menu_event); |
| 466 | #endif | 465 | #endif |
| 467 | unblock_input (); | 466 | unblock_input (); |
diff --git a/src/xterm.c b/src/xterm.c index 4ca68848d2e..9a4f5d39e2e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -9388,6 +9388,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 9388 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); | 9388 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 9389 | 9389 | ||
| 9390 | f = x_top_window_to_frame (dpyinfo, event->xcrossing.window); | 9390 | f = x_top_window_to_frame (dpyinfo, event->xcrossing.window); |
| 9391 | #if defined HAVE_X_TOOLKIT && defined HAVE_XINPUT2 | ||
| 9392 | /* The XI2 event mask is set on the frame widget, so this event | ||
| 9393 | likely originates from the shell widget, which we aren't | ||
| 9394 | interested in. */ | ||
| 9395 | if (dpyinfo->supports_xi2) | ||
| 9396 | f = NULL; | ||
| 9397 | #endif | ||
| 9391 | if (f) | 9398 | if (f) |
| 9392 | { | 9399 | { |
| 9393 | if (f == hlinfo->mouse_face_mouse_frame) | 9400 | if (f == hlinfo->mouse_face_mouse_frame) |
| @@ -10052,7 +10059,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 10052 | x_display_set_last_user_time (dpyinfo, xi_event->time); | 10059 | x_display_set_last_user_time (dpyinfo, xi_event->time); |
| 10053 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); | 10060 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 10054 | 10061 | ||
| 10062 | #ifndef USE_X_TOOLKIT | ||
| 10055 | f = x_top_window_to_frame (dpyinfo, leave->event); | 10063 | f = x_top_window_to_frame (dpyinfo, leave->event); |
| 10064 | #else | ||
| 10065 | /* On Xt builds that have XI2, the enter and leave event | ||
| 10066 | masks are set on the frame widget's window. */ | ||
| 10067 | f = x_window_to_frame (dpyinfo, leave->event); | ||
| 10068 | #endif | ||
| 10056 | if (f) | 10069 | if (f) |
| 10057 | { | 10070 | { |
| 10058 | if (f == hlinfo->mouse_face_mouse_frame) | 10071 | if (f == hlinfo->mouse_face_mouse_frame) |