[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 32e1894943: Fix menus on the no-toolkit build when using XI2
From: |
Po Lu |
Subject: |
master 32e1894943: Fix menus on the no-toolkit build when using XI2 |
Date: |
Sun, 23 Jan 2022 06:35:33 -0500 (EST) |
branch: master
commit 32e1894943ee9bf9e17afa92b1520d3c4765e37a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix menus on the no-toolkit build when using XI2
* src/xmenu.c (x_activate_menubar):
(create_and_show_popup_menu): Only ungrab the device if it is
actually grabbed.
(x_menu_show): Release XI2 passive grab.
---
src/xmenu.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/xmenu.c b/src/xmenu.c
index b755f75da0..9e4e6b62fc 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -457,8 +457,11 @@ x_activate_menubar (struct frame *f)
if (dpyinfo->num_devices)
{
for (int i = 0; i < dpyinfo->num_devices; ++i)
- XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
- CurrentTime);
+ {
+ if (dpyinfo->devices[i].grab)
+ XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
+ CurrentTime);
+ }
}
#endif
XtDispatchEvent (f->output_data.x->saved_menu_event);
@@ -1469,8 +1472,11 @@ create_and_show_popup_menu (struct frame *f,
widget_value *first_wv,
if (dpyinfo->num_devices)
{
for (int i = 0; i < dpyinfo->num_devices; ++i)
- XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
- CurrentTime);
+ {
+ if (dpyinfo->devices[i].grab)
+ XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
+ CurrentTime);
+ }
}
#endif
/* Display the menu. */
@@ -2367,6 +2373,22 @@ x_menu_show (struct frame *f, int x, int y, int
menuflags,
/* Help display under X won't work because XMenuActivate contains
a loop that doesn't give Emacs a chance to process it. */
menu_help_frame = f;
+
+#ifdef HAVE_XINPUT2
+ struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+ /* Clear the XI2 grab so a core grab can be set. */
+
+ if (dpyinfo->num_devices)
+ {
+ for (int i = 0; i < dpyinfo->num_devices; ++i)
+ {
+ if (dpyinfo->devices[i].grab)
+ XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
+ CurrentTime);
+ }
+ }
+#endif
+
status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
x, y, ButtonReleaseMask, &datap,
menu_help_callback);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 32e1894943: Fix menus on the no-toolkit build when using XI2,
Po Lu <=