emacs-diffs
[Top][All Lists]
Advanced

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

master 649b43d20c: Make Lucid menus work from the keyboard also when uni


From: Lars Ingebrigtsen
Subject: master 649b43d20c: Make Lucid menus work from the keyboard also when uninstalled
Date: Tue, 21 Jun 2022 06:17:21 -0400 (EDT)

branch: master
commit 649b43d20cf75e61fab289f99d20e98b035d5a9a
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make Lucid menus work from the keyboard also when uninstalled
    
    * lwlib/xlwmenu.c (ungrab_all, pop_up_menu): Use it.
    
    * src/keyboard.c (syms_of_keyboard): New variable (bug#46990).
---
 lwlib/xlwmenu.c | 10 +++-------
 src/keyboard.c  |  9 +++++++++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index ace5141cdb..f0625982cf 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -245,11 +245,6 @@ WidgetClass xlwMenuWidgetClass = (WidgetClass) 
&xlwMenuClassRec;
 
 int submenu_destroyed;
 
-/* For debug, if installation-directory is non-nil this is not an installed
-   Emacs.   In that case we do not grab the keyboard to make it easier to
-   debug. */
-#define GRAB_KEYBOARD  (EQ (Vinstallation_directory, Qnil))
-
 static int next_release_must_exit;
 
 /* Utilities */
@@ -259,7 +254,8 @@ static void
 ungrab_all (Widget w, Time ungrabtime)
 {
   XtUngrabPointer (w, ungrabtime);
-  if (GRAB_KEYBOARD) XtUngrabKeyboard (w, ungrabtime);
+  if (!lucid__menu_grab_keyboard)
+    XtUngrabKeyboard (w, ungrabtime);
 }
 
 /* Like abort, but remove grabs from widget W before.  */
@@ -2721,7 +2717,7 @@ pop_up_menu (XlwMenuWidget mw, XButtonPressedEvent *event)
                      mw->menu.cursor_shape,
                      event->time) == Success)
     {
-      if (! GRAB_KEYBOARD
+      if (!lucid__menu_grab_keyboard
           || XtGrabKeyboard ((Widget)mw, False, GrabModeAsync,
                              GrabModeAsync, event->time) == Success)
         {
diff --git a/src/keyboard.c b/src/keyboard.c
index e62b2e56d3..c41727d6c6 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -12648,6 +12648,15 @@ See also `pre-command-hook'.  */);
               doc: /* Non-nil means menu bar, specified Lucid style, needs to 
be recomputed.  */);
   Vlucid_menu_bar_dirty_flag = Qnil;
 
+#ifdef USE_LUCID
+  DEFVAR_BOOL ("lucid--menu-grab-keyboard",
+               lucid__menu_grab_keyboard,
+               doc: /* If non-nil, grab keyboard during menu operations.
+This is only relevant when using the Lucid X toolkit.  It can be
+convenient to disable this for debugging purposes.  */);
+  lucid__menu_grab_keyboard = true;
+#endif
+
   DEFVAR_LISP ("menu-bar-final-items", Vmenu_bar_final_items,
               doc: /* List of menu bar items to move to the end of the menu 
bar.
 The elements of the list are event types that may have menu bar



reply via email to

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