aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2021-12-27 09:16:18 +0800
committerPo Lu2021-12-27 09:16:18 +0800
commit2ccb1568876f6ac7d8b980d60d91a689e797ab36 (patch)
tree8a14c53b473ec5f646060889f05a452c4f2c3df8 /src
parent736bf3aaa72e8fdd1c37bb9c8d003b17ffb612f9 (diff)
downloademacs-2ccb1568876f6ac7d8b980d60d91a689e797ab36.tar.gz
emacs-2ccb1568876f6ac7d8b980d60d91a689e797ab36.zip
Fix Lucid popup menu being stuck on XI2 builds
* src/xmenu.c (x_activate_menubar): Make some changes conditional on XI2. (create_and_show_popup_menu): Clear XI2 grab before showing popup. * src/xterm.c (xi_grab_or_ungrab_device): Don't grab device if popup is activated on Lucid.
Diffstat (limited to 'src')
-rw-r--r--src/xmenu.c12
-rw-r--r--src/xterm.c2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index 4d969fa25f8..9b0353f133f 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -449,6 +449,7 @@ x_activate_menubar (struct frame *f)
449 f->output_data.x->saved_menu_event); 449 f->output_data.x->saved_menu_event);
450#else 450#else
451#ifdef USE_MOTIF 451#ifdef USE_MOTIF
452#ifdef HAVE_XINPUT2
452 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 453 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
453 /* Clear the XI2 grab so Motif can set a core grab. Otherwise some 454 /* Clear the XI2 grab so Motif can set a core grab. Otherwise some
454 versions of Motif will emit a warning and hang. */ 455 versions of Motif will emit a warning and hang. */
@@ -460,6 +461,7 @@ x_activate_menubar (struct frame *f)
460 CurrentTime); 461 CurrentTime);
461 } 462 }
462#endif 463#endif
464#endif
463 XtDispatchEvent (f->output_data.x->saved_menu_event); 465 XtDispatchEvent (f->output_data.x->saved_menu_event);
464#endif 466#endif
465 unblock_input (); 467 unblock_input ();
@@ -1461,7 +1463,17 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1461 /* Don't allow any geometry request from the user. */ 1463 /* Don't allow any geometry request from the user. */
1462 XtSetArg (av[ac], (char *) XtNgeometry, 0); ac++; 1464 XtSetArg (av[ac], (char *) XtNgeometry, 0); ac++;
1463 XtSetValues (menu, av, ac); 1465 XtSetValues (menu, av, ac);
1466#if defined HAVE_XINPUT2 && defined USE_LUCID
1467 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
1468 /* Clear the XI2 grab so lwlib can set a core grab. */
1464 1469
1470 if (dpyinfo->num_devices)
1471 {
1472 for (int i = 0; i < dpyinfo->num_devices; ++i)
1473 XIUngrabDevice (dpyinfo->display, dpyinfo->devices[i].device_id,
1474 CurrentTime);
1475 }
1476#endif
1465 /* Display the menu. */ 1477 /* Display the menu. */
1466 lw_popup_menu (menu, &dummy); 1478 lw_popup_menu (menu, &dummy);
1467 popup_activated_flag = 1; 1479 popup_activated_flag = 1;
diff --git a/src/xterm.c b/src/xterm.c
index 8ba4f46c2c9..4ca68848d2e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -638,7 +638,7 @@ xi_grab_or_ungrab_device (struct xi_device_t *device,
638 XISetMask (m, XI_Leave); 638 XISetMask (m, XI_Leave);
639 639
640 if (device->grab 640 if (device->grab
641#ifdef USE_MOTIF 641#if defined USE_MOTIF || defined USE_LUCID
642 && !popup_activated () 642 && !popup_activated ()
643#endif 643#endif
644 ) 644 )