Merge lp:~attente/gtk/menu-binding-emit-submenu-close-after-activate into lp:~ubuntu-desktop/gtk/ubuntugtk3

Proposed by William Hua on 2014-06-17
Status: Merged
Merged at revision: 352
Proposed branch: lp:~attente/gtk/menu-binding-emit-submenu-close-after-activate
Merge into: lp:~ubuntu-desktop/gtk/ubuntugtk3
Diff against target: 133 lines (+105/-1)
3 files modified
debian/changelog (+7/-1)
debian/patches/git-menu-binding-emit-submenu-close-after-activate.patch (+97/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~attente/gtk/menu-binding-emit-submenu-close-after-activate
Reviewer Review Type Date Requested Status
Sebastien Bacher 2014-06-17 Approve on 2014-06-18
Review via email: mp+223420@code.launchpad.net

Commit message

Take upstream's menu-binding-emit-submenu-close-after-activate commit, which ensures that menu item activations occur before GMenuModel submenu-action state changes.

Description of the change

Take upstream's menu-binding-emit-submenu-close-after-activate commit, which ensures that menu item activations occur before GMenuModel submenu-action state changes.

To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

That should work, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-06-13 09:34:40 +0000
3+++ debian/changelog 2014-06-17 15:15:20 +0000
4@@ -1,11 +1,17 @@
5 gtk+3.0 (3.12.2-0ubuntu3) UNRELEASED; urgency=medium
6
7+ [ Lars Uebernickel ]
8 * Remove a11y-tests-disable-color-chooser-and-message-dialog-.patch:
9 update title bar and message dialog patches with the proper fixes instead
10 * Remove revert-fix-up-builder.patch: Dialogs have one child again:
11 included in the title bar patch now
12
13- -- Lars Uebernickel <lars.uebernickel@ubuntu.com> Thu, 12 Jun 2014 11:06:44 +0200
14+ [ William Hua ]
15+ * Take upstream git-menu-binding-emit-submenu-close-after-activate.patch:
16+ - Ensures that menu item activations occur before GMenuModel
17+ submenu-action state changes (LP: #1208019)
18+
19+ -- William Hua <william.hua@canonical.com> Tue, 17 Jun 2014 10:15:41 -0400
20
21 gtk+3.0 (3.12.2-0ubuntu2) utopic; urgency=medium
22
23
24=== added file 'debian/patches/git-menu-binding-emit-submenu-close-after-activate.patch'
25--- debian/patches/git-menu-binding-emit-submenu-close-after-activate.patch 1970-01-01 00:00:00 +0000
26+++ debian/patches/git-menu-binding-emit-submenu-close-after-activate.patch 2014-06-17 15:15:20 +0000
27@@ -0,0 +1,97 @@
28+From b532e1ff0ab25303c838565220e8d41fb3044a05 Mon Sep 17 00:00:00 2001
29+From: Ryan Lortie <desrt@desrt.ca>
30+Date: Mon, 16 Jun 2014 14:26:21 -0400
31+Subject: [PATCH] menu binding: emit submenu close after activate
32+
33+We want to make sure that the submenu action is changed back to FALSE
34+_after_ the menu item has been activated. This prevents the menu
35+teardown handler from deleting the menu item before it can be activated.
36+
37+Unfortunately, GtkMenuShell emits "hide" before the item activation.
38+This is probably done to prevent the application from doing things like
39+showing dialogs when the menu is still holding the grab.
40+
41+In the case where we are doing an activate, set a boolean flag on each
42+of the open menus (following the parent stack) indicating that we'll be
43+emitting another signal soon (selection done). If that flag is set, we
44+defer the setting of the submenu action until we receive the second
45+signal.
46+
47+https://bugzilla.gnome.org/show_bug.cgi?id=729820
48+---
49+ gtk/gtkmenushell.c | 21 +++++++++++++++++++--
50+ gtk/gtkmenushellprivate.h | 5 +++++
51+ 2 files changed, 24 insertions(+), 2 deletions(-)
52+
53+diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
54+index 18f1542..d1d0c7f 100644
55+--- a/gtk/gtkmenushell.c
56++++ b/gtk/gtkmenushell.c
57+@@ -1360,6 +1360,8 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
58+
59+ do
60+ {
61++ parent_menu_shell->priv->selection_done_coming_soon = TRUE;
62++
63+ g_object_ref (parent_menu_shell);
64+ shells = g_slist_prepend (shells, parent_menu_shell);
65+ parent_menu_shell = (GtkMenuShell*) parent_menu_shell->priv->parent_menu_shell;
66+@@ -1379,7 +1381,10 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
67+
68+ for (slist = shells; slist; slist = slist->next)
69+ {
70+- g_signal_emit (slist->data, menu_shell_signals[SELECTION_DONE], 0);
71++ GtkMenuShell *parent_menu_shell = slist->data;
72++
73++ g_signal_emit (parent_menu_shell, menu_shell_signals[SELECTION_DONE], 0);
74++ parent_menu_shell->priv->selection_done_coming_soon = FALSE;
75+ g_object_unref (slist->data);
76+ }
77+ g_slist_free (shells);
78+@@ -2010,7 +2015,18 @@ gtk_menu_shell_submenu_hidden (GtkWidget *submenu,
79+ {
80+ GtkMenuTrackerItem *item = user_data;
81+
82+- gtk_menu_tracker_item_request_submenu_shown (item, FALSE);
83++ if (!GTK_MENU_SHELL (submenu)->priv->selection_done_coming_soon)
84++ gtk_menu_tracker_item_request_submenu_shown (item, FALSE);
85++}
86++
87++static void
88++gtk_menu_shell_submenu_selection_done (GtkWidget *submenu,
89++ gpointer user_data)
90++{
91++ GtkMenuTrackerItem *item = user_data;
92++
93++ if (GTK_MENU_SHELL (submenu)->priv->selection_done_coming_soon)
94++ gtk_menu_tracker_item_request_submenu_shown (item, FALSE);
95+ }
96+
97+ static void
98+@@ -2091,6 +2107,7 @@ gtk_menu_shell_tracker_insert_func (GtkMenuTrackerItem *item,
99+ */
100+ g_signal_connect (submenu, "show", G_CALLBACK (gtk_menu_shell_submenu_shown), item);
101+ g_signal_connect (submenu, "hide", G_CALLBACK (gtk_menu_shell_submenu_hidden), item);
102++ g_signal_connect (submenu, "selection-done", G_CALLBACK (gtk_menu_shell_submenu_selection_done), item);
103+ }
104+
105+ gtk_widget_show (widget);
106+diff --git a/gtk/gtkmenushellprivate.h b/gtk/gtkmenushellprivate.h
107+index 622f0fd..233be34 100644
108+--- a/gtk/gtkmenushellprivate.h
109++++ b/gtk/gtkmenushellprivate.h
110+@@ -61,6 +61,11 @@ struct _GtkMenuShellPrivate
111+ * the user moves the mouse over
112+ * an unselectable menuitem.
113+ */
114++
115++ guint selection_done_coming_soon : 1; /* Set TRUE when a selection-done
116++ * signal is coming soon (when checked
117++ * from inside of a "hide" handler).
118++ */
119+ GtkMnemonicHash *mnemonic_hash;
120+ GtkKeyHash *key_hash;
121+
122+--
123+2.0.0
124+
125
126=== modified file 'debian/patches/series'
127--- debian/patches/series 2014-06-13 09:04:58 +0000
128+++ debian/patches/series 2014-06-17 15:15:20 +0000
129@@ -1,3 +1,4 @@
130+git-menu-binding-emit-submenu-close-after-activate.patch
131 016_no_offscreen_widgets_grabbing.patch
132 017_no_offscreen_device_grabbing.patch
133 018_gdkenumtypes.c_location.patch

Subscribers

People subscribed via source and target branches

to all changes: