aboutsummaryrefslogtreecommitdiff
path: root/module/menuitem-proxy.c
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2014-05-22 22:54:11 +0200
committerJavier <dev.git@javispedro.com>2014-05-22 22:54:11 +0200
commit4c02d3a0ce08aab4e4b89b4eee7a72145e66c33a (patch)
tree89ca2f004d01eb2004afe248a54efde274017051 /module/menuitem-proxy.c
parent14d288511323d4f384d4764ab25a42693ff19f4a (diff)
downloadtopmenu-gtk-4c02d3a0ce08aab4e4b89b4eee7a72145e66c33a.tar.gz
topmenu-gtk-4c02d3a0ce08aab4e4b89b4eee7a72145e66c33a.zip
additional gtk2 fixes
Diffstat (limited to 'module/menuitem-proxy.c')
-rw-r--r--module/menuitem-proxy.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/module/menuitem-proxy.c b/module/menuitem-proxy.c
index fbab6f1..935c29a 100644
--- a/module/menuitem-proxy.c
+++ b/module/menuitem-proxy.c
@@ -185,6 +185,26 @@ struct _GtkMenuItemPrivate
};
#endif
+static gboolean
+menu_shell_is_active(GtkMenuShell *shell)
+{
+#if GTK_MAJOR_VERSION == 3
+ return shell->priv->active;
+#else
+ return shell->active;
+#endif
+}
+
+static void
+menu_shell_set_active(GtkMenuShell *shell, gboolean active)
+{
+#if GTK_MAJOR_VERSION == 3
+ shell->priv->active = active;
+#else
+ shell->active = active;
+#endif
+}
+
static void
free_timeval (GTimeVal *val)
{
@@ -563,7 +583,8 @@ static gboolean handle_menuitem_mnemonic_activate(GtkMenuItem *item, gboolean cy
if (parent && monitor->available) {
GtkMenuShell *parent_shell = GTK_MENU_SHELL(parent);
- if (GTK_IS_MENU_BAR(parent_shell) || parent_shell->priv->active) {
+
+ if (GTK_IS_MENU_BAR(parent_shell) || menu_shell_is_active(parent_shell)) {
gtk_widget_mnemonic_activate(GTK_WIDGET(proxy), cycling);
return TRUE;
}
@@ -599,7 +620,7 @@ static void handle_proxy_select(GtkMenuItem *proxy, GtkMenuItem *item)
GtkMenuShell *parent_shell = GTK_MENU_SHELL(parent);
GTimeVal *popup_time = g_slice_new0(GTimeVal);
- g_get_current_time(popup_time);
+ g_get_current_time(popup_time);
g_object_set_data_full(G_OBJECT(submenu),
"gtk-menu-exact-popup-time", popup_time,
(GDestroyNotify) free_timeval);
@@ -615,7 +636,11 @@ static void handle_proxy_select(GtkMenuItem *proxy, GtkMenuItem *item)
GTK_WIDGET(proxy),
menu_item_position_menu,
proxy,
+#if GTK_MAJOR_VERSION == 3
parent_shell->priv->button,
+#else
+ parent_shell->button,
+#endif
0);
}
}
@@ -650,7 +675,8 @@ static void handle_proxy_activate_item(GtkMenuItem *proxy, GtkMenuItem *item)
if (submenu) {
GtkMenuShell *parent = GTK_MENU_SHELL(gtk_widget_get_parent(GTK_WIDGET(proxy)));
if (parent) {
- parent->priv->active = TRUE;
+ menu_shell_set_active(parent, TRUE);
+
// We do not add grabs here, like Gtk+ does, because they are already done.
gtk_menu_shell_select_item(parent, GTK_WIDGET(proxy));
gtk_menu_shell_select_first(GTK_MENU_SHELL(submenu), TRUE);