]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix menu window persistence and entry/leave events on Lucid on XI2
authorPo Lu <luangruo@yahoo.com>
Mon, 27 Dec 2021 02:02:39 +0000 (10:02 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 27 Dec 2021 02:05:01 +0000 (10:05 +0800)
* 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
src/xterm.c

index 9b0353f133ff13193dc3b09a71dd10d539a5e04c..f3b7c45ffffe92d81aeddd1413beacea74448cf2 100644 (file)
@@ -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
index 4ca68848d2e69d53c60c12e233f48ac27d1f5f6b..9a4f5d39e2e0b168a716e24eceff596c017e1a12 100644 (file)
@@ -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)