emacs-diffs
[Top][All Lists]
Advanced

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

master 65fea3ff58: Fix menu bar activation on PGTK


From: Po Lu
Subject: master 65fea3ff58: Fix menu bar activation on PGTK
Date: Wed, 9 Mar 2022 22:50:24 -0500 (EST)

branch: master
commit 65fea3ff58cdb012340d7e5755188df213df480a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix menu bar activation on PGTK
    
    * src/gtkutil.c (menu_bar_button_pressed_cb): Only update menu
    bar if no menu is active, and the event window is not the widget
    window itself.  Also make menu in use.
    * src/pgtkmenu.c (popup_deactivate_callback): Make menu not in
    use.
    * src/xdisp.c (redisplay_internal): Return if popup_activated
    also on PGTK.
---
 src/gtkutil.c  | 9 +++++++--
 src/pgtkmenu.c | 4 ++--
 src/xdisp.c    | 6 ++----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index 2a64781088..1b4ecaf949 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3282,8 +3282,13 @@ menu_bar_button_pressed_cb (GtkWidget *widget, GdkEvent 
*event,
 {
   struct frame *f = user_data;
 
-  if (event->button.button < 4)
-    set_frame_menubar (f, true);
+  if (event->button.button < 4
+      && event->button.window != gtk_widget_get_window (widget)
+      && !popup_activated ())
+    {
+      pgtk_menu_set_in_use (true);
+      set_frame_menubar (f, true);
+    }
 
   return false;
 }
diff --git a/src/pgtkmenu.c b/src/pgtkmenu.c
index 7a3bfea451..bd63af3b22 100644
--- a/src/pgtkmenu.c
+++ b/src/pgtkmenu.c
@@ -43,7 +43,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <gtk/gtk.h>
 
 /* Flag which when set indicates a dialog or menu has been posted by
-   Xt on behalf of one of the widget sets.  */
+   GTK on behalf of one of the widget sets.  */
 static int popup_activated_flag;
 
 /* Set menu_items_inuse so no other popup menu or dialog is created.  */
@@ -132,7 +132,7 @@ pgtk_activate_menubar (struct frame *f)
 static void
 popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
 {
-  popup_activated_flag = 0;
+  pgtk_menu_set_in_use (false);
 }
 
 /* Function that finds the frame for WIDGET and shows the HELP text
diff --git a/src/xdisp.c b/src/xdisp.c
index acb9cb7283..5cb58391dd 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16037,11 +16037,9 @@ redisplay_internal (void)
   if (!fr->glyphs_initialized_p)
     return;
 
-#if defined (USE_X_TOOLKIT) || (defined (USE_GTK) && !defined (HAVE_PGTK)) || 
defined (HAVE_NS)
+#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS)
   if (popup_activated ())
-    {
-      return;
-    }
+    return;
 #endif
 
 #if defined (HAVE_HAIKU)



reply via email to

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