[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d9977018e0: Fix menu window persistence and entry/leave events on
From: |
Po Lu |
Subject: |
master d9977018e0: Fix menu window persistence and entry/leave events on Lucid on XI2 |
Date: |
Sun, 26 Dec 2021 21:06:00 -0500 (EST) |
branch: master
commit d9977018e045be002f2b48254215fda5f3a067fc
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
src/xmenu.c | 9 ++++-----
src/xterm.c | 13 +++++++++++++
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/xmenu.c b/src/xmenu.c
index 9b0353f133..f3b7c45fff 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -448,11 +448,11 @@ x_activate_menubar (struct frame *f)
XPutBackEvent (f->output_data.x->display_info->display,
f->output_data.x->saved_menu_event);
#else
-#ifdef USE_MOTIF
-#ifdef HAVE_XINPUT2
+#if defined USE_X_TOOLKIT && defined HAVE_XINPUT2
struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
- /* Clear the XI2 grab so Motif can set a core grab. Otherwise some
- versions of Motif will emit a warning and hang. */
+ /* Clear the XI2 grab so Motif or lwlib can set a core grab.
+ Otherwise some versions of Motif will emit a warning and hang,
+ and lwlib will fail to destroy the menu window. */
if (dpyinfo->num_devices)
{
@@ -460,7 +460,6 @@ x_activate_menubar (struct frame *f)
XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
CurrentTime);
}
-#endif
#endif
XtDispatchEvent (f->output_data.x->saved_menu_event);
#endif
diff --git a/src/xterm.c b/src/xterm.c
index 4ca68848d2..9a4f5d39e2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9388,6 +9388,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
f = x_top_window_to_frame (dpyinfo, event->xcrossing.window);
+#if defined HAVE_X_TOOLKIT && defined HAVE_XINPUT2
+ /* The XI2 event mask is set on the frame widget, so this event
+ likely originates from the shell widget, which we aren't
+ interested in. */
+ if (dpyinfo->supports_xi2)
+ f = NULL;
+#endif
if (f)
{
if (f == hlinfo->mouse_face_mouse_frame)
@@ -10052,7 +10059,13 @@ handle_one_xevent (struct x_display_info *dpyinfo,
x_display_set_last_user_time (dpyinfo, xi_event->time);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
+#ifndef USE_X_TOOLKIT
f = x_top_window_to_frame (dpyinfo, leave->event);
+#else
+ /* On Xt builds that have XI2, the enter and leave event
+ masks are set on the frame widget's window. */
+ f = x_window_to_frame (dpyinfo, leave->event);
+#endif
if (f)
{
if (f == hlinfo->mouse_face_mouse_frame)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master d9977018e0: Fix menu window persistence and entry/leave events on Lucid on XI2,
Po Lu <=