emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 834383f1e1: Fix focus reversion of Motif menus on XI2


From: Po Lu
Subject: master 834383f1e1: Fix focus reversion of Motif menus on XI2
Date: Fri, 29 Apr 2022 21:30:32 -0400 (EDT)

branch: master
commit 834383f1e14d7a0e027bb315c46f4961093c7e2d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix focus reversion of Motif menus on XI2
    
    * src/xmenu.c (create_and_show_popup_menu): Stop setting input
    focus on the menu window.
---
 src/xmenu.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/src/xmenu.c b/src/xmenu.c
index 316dacee5b..418628d491 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1718,7 +1718,7 @@ create_and_show_popup_menu (struct frame *f, widget_value 
*first_wv,
   XtSetArg (av[ac], (char *) XtNgeometry, 0); ac++;
   XtSetValues (menu, av, ac);
 
-#if defined HAVE_XINPUT2
+#ifdef HAVE_XINPUT2
   struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   bool any_xi_grab_p = false;
 
@@ -1779,20 +1779,14 @@ create_and_show_popup_menu (struct frame *f, 
widget_value *first_wv,
       XtDispatchEvent (&property_dummy);
     }
 #endif
-
-  if (dpyinfo->supports_xi2)
-    XUngrabServer (dpyinfo->display);
 #endif
 
   /* Display the menu.  */
   lw_popup_menu (menu, &dummy);
 
-#if defined HAVE_XINPUT2 && defined USE_MOTIF
-  /* This is needed to prevent XI_Enter events that set an implicit
-     focus from being sent.  */
+#ifdef HAVE_XINPUT2
   if (dpyinfo->supports_xi2)
-    XSetInputFocus (XtDisplay (menu), XtWindow (menu),
-                   RevertToParent, CurrentTime);
+    XUngrabServer (dpyinfo->display);
 #endif
 
   popup_activated_flag = 1;
@@ -1814,14 +1808,6 @@ create_and_show_popup_menu (struct frame *f, 
widget_value *first_wv,
 
     unbind_to (specpdl_count, Qnil);
   }
-
-#if defined HAVE_XINPUT2 && defined USE_MOTIF
-  /* For some reason input focus isn't always restored to the outer
-     window after the menu pops down.  */
-  if (any_xi_grab_p)
-    XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
-                   RevertToParent, CurrentTime);
-#endif
 }
 
 #endif /* not USE_GTK */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]