[gtk+/gtk-3-8] menushell: don't activate a menu entry when opening a big menu
- From: Emilio Pozuelo Monfort <epm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-8] menushell: don't activate a menu entry when opening a big menu
- Date: Thu, 27 Jun 2013 18:21:16 +0000 (UTC)
commit bd3f7f061951d7581b0a88518dec017674707dc5
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date: Thu Jun 27 19:01:14 2013 +0200
menushell: don't activate a menu entry when opening a big menu
If a menu is opened and it doesn't fit entirely below or above
the menu bar, gtk+ will place it on top. The button release will
then activate the popup item that happens to appear under the
cursor. Avoid this by ignoring release events if they originated
in the parent menu bar and the duration of the press was too short.
https://bugzilla.gnome.org/show_bug.cgi?id=703069
gtk/gtkmenushell.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index ae36459..8f82f38 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -803,6 +803,18 @@ gtk_menu_shell_button_release (GtkWidget *widget,
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
GtkMenuShellPrivate *priv = menu_shell->priv;
+ if (priv->parent_menu_shell &&
+ (event->time - GTK_MENU_SHELL (priv->parent_menu_shell)->priv->activate_time) < MENU_SHELL_TIMEOUT)
+ {
+ /* The button-press originated in the parent menu bar and we are
+ * a pop-up menu. It was a quick press-and-release so we don't want
+ * to activate an item but we leave the popup in place instead.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=703069
+ */
+ GTK_MENU_SHELL (priv->parent_menu_shell)->priv->activate_time = 0;
+ return TRUE;
+ }
+
if (priv->active)
{
GtkWidget *menu_item;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]