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)