diff options
author | Michael Natterer <mitch@gimp.org> | 2005-03-31 17:02:19 +0000 |
---|---|---|
committer | Michael Natterer <mitch@src.gnome.org> | 2005-03-31 17:02:19 +0000 |
commit | 91cb92c01882f7a3b1014c594908873fc18a936c (patch) | |
tree | e18e289edfbd0dd442fac1df3d3c4439223b29da /gtk/gtkmenuitem.c | |
parent | 420878b21e654c49ade3b5670aed281beaeb2508 (diff) | |
download | gtk+-91cb92c01882f7a3b1014c594908873fc18a936c.tar.gz |
Allow to pop up menus without grabbing the keyboard. Useful for stuff like
2005-03-31 Michael Natterer <mitch@gimp.org>
Allow to pop up menus without grabbing the keyboard. Useful for
stuff like virtual keyboards. Fixes bug #159890
* gtk/gtk.symbols
* gtk/gtkmenushell.[ch]: added boolean property "take-focus"
and public API gtk_menu_shell_set/get_take_focus().
* gtk/gtkmenu.c (gtk_menu_popup)
(popup_grab_on_window): don't grab the keyboard if take_focus
is FALSE.
* gtk/gtkmenuitem.c (_gtk_menu_item_popup_submen): propagate the
parent menu_shell's take_focus property to the submenu which is
about to be popped up.
Diffstat (limited to 'gtk/gtkmenuitem.c')
-rw-r--r-- | gtk/gtkmenuitem.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index c9e5e3a6dc..433cc41022 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -1054,13 +1054,21 @@ _gtk_menu_item_popup_submenu (GtkWidget *widget) menu_item->timer = 0; if (GTK_WIDGET_IS_SENSITIVE (menu_item->submenu)) - gtk_menu_popup (GTK_MENU (menu_item->submenu), - widget->parent, - widget, - gtk_menu_item_position_menu, - menu_item, - GTK_MENU_SHELL (widget->parent)->button, - 0); + { + gboolean take_focus; + + take_focus = gtk_menu_shell_get_take_focus (GTK_MENU_SHELL (widget->parent)); + gtk_menu_shell_set_take_focus (GTK_MENU_SHELL (menu_item->submenu), + take_focus); + + gtk_menu_popup (GTK_MENU (menu_item->submenu), + widget->parent, + widget, + gtk_menu_item_position_menu, + menu_item, + GTK_MENU_SHELL (widget->parent)->button, + 0); + } } static void |