From: Po Lu Date: Thu, 10 Mar 2022 03:48:12 +0000 (+0800) Subject: Fix menu bar activation on PGTK X-Git-Tag: emacs-29.0.90~1936 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=65fea3ff58cdb012340d7e5755188df213df480a;p=emacs.git 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. --- diff --git a/src/gtkutil.c b/src/gtkutil.c index 2a647810886..1b4ecaf9492 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 7a3bfea4518..bd63af3b223 100644 --- a/src/pgtkmenu.c +++ b/src/pgtkmenu.c @@ -43,7 +43,7 @@ along with GNU Emacs. If not, see . */ #include /* 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 acb9cb7283c..5cb58391dde 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)