summaryrefslogtreecommitdiff
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-03-02 09:01:48 +0800
committerPo Lu <luangruo@yahoo.com>2022-03-02 09:01:48 +0800
commit006a4474551ed43515c6249d2ed4cfcaefd9b7a5 (patch)
tree006b587d94f14073be39b42adff9727efb46cdeb /src/xmenu.c
parentcaae254bb478ad83ba9caec6ec94b54e9abfb4c9 (diff)
downloademacs-006a4474551ed43515c6249d2ed4cfcaefd9b7a5.tar.gz
Improve behavior of Motif popup menus on XI2
* src/xmenu.c (create_and_show_popup_menu): Set input focus to menu window.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index fb80221e15b..e085fa1ace5 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1728,6 +1728,15 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
/* 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. */
+ if (dpyinfo->supports_xi2)
+ XSetInputFocus (XtDisplay (menu), XtWindow (menu),
+ RevertToParent, CurrentTime);
+#endif
+
popup_activated_flag = 1;
#if defined HAVE_XINPUT2 && !defined USE_MOTIF