diff options
Diffstat (limited to 'libdbusmenu-gtk/parser.c')
-rw-r--r-- | libdbusmenu-gtk/parser.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 39cc9f8..6244b07 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -340,7 +340,7 @@ parser_data_free (ParserData * pdata) return; } -/* Gets the positon of the child with its' parent if it has one. +/* Gets the positon of the child with its parent if it has one. Returns -1 if the position is unable to be calculated. */ static gint get_child_position (GtkWidget * child) @@ -1121,6 +1121,14 @@ item_activated (DbusmenuMenuitem *item, guint timestamp, gpointer user_data) if (GTK_IS_MENU_ITEM (child)) { + GtkWidget *parent = gtk_widget_get_parent(child); + if (GTK_IS_MENU (parent)) + { + gint pos = get_child_position (child); + if (pos >= 0) + gtk_menu_set_active (GTK_MENU(parent), pos); + } + gdk_threads_enter (); gtk_menu_item_activate (GTK_MENU_ITEM (child)); gdk_threads_leave (); |