diff options
author | Soeren Sandmann <sandmann@daimi.au.dk> | 2004-02-21 18:20:59 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2004-02-21 18:20:59 +0000 |
commit | d49a0c52bc137b0b9e7dd5b4afd645b3b4dc60ab (patch) | |
tree | 98b8ec587a744716f483a608a6fde635dece259e /gtk/gtkmenu.c | |
parent | e5b5c4cda442844f0cebe739a9d807d3fa5b1e23 (diff) | |
download | gtk+-d49a0c52bc137b0b9e7dd5b4afd645b3b4dc60ab.tar.gz |
Bug 132502
Sat Feb 21 19:18:26 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Bug 132502
* gtk/gtkmenu.c (gtk_menu_motion_notify): Make sure we pop down
if we enter a non-selectable menu item.
* gtk/gtkmenu.c (gtk_menu_leave_notify): Don't pop a submenu
when the user has left the item.
Diffstat (limited to 'gtk/gtkmenu.c')
-rw-r--r-- | gtk/gtkmenu.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 6bc690b025..c7b7d04df3 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -2609,7 +2609,6 @@ gtk_menu_motion_notify (GtkWidget *widget, */ menu_item = gtk_get_event_widget ((GdkEvent*) event); if (!menu_item || !GTK_IS_MENU_ITEM (menu_item) || - !_gtk_menu_item_is_selectable (menu_item) || !GTK_IS_MENU (menu_item->parent)) return FALSE; @@ -2623,6 +2622,15 @@ gtk_menu_motion_notify (GtkWidget *widget, if (gtk_menu_navigating_submenu (menu, event->x_root, event->y_root)) return TRUE; + /* Make sure we pop down if we enter a non-selectable menu item, so we + * don't show a submenu when the cursor is outside the stay-up triangle. + */ + if (!_gtk_menu_item_is_selectable (menu_item)) + { + gtk_menu_shell_deselect (menu_shell); + return FALSE; + } + if (need_enter) { /* The menu is now sensitive to enter events on its items, but @@ -2872,6 +2880,15 @@ gtk_menu_leave_notify (GtkWidget *widget, gtk_menu_set_submenu_navigation_region (menu, menu_item, event); return TRUE; } + else if (menu_item == menu_shell->active_menu_item) + { + /* We are leaving an active menu item with nonactive submenu. + * Deselect it so we don't surprise the user with by popping + * up a submenu _after_ he left the item. + */ + gtk_menu_shell_deselect (menu_shell); + return TRUE; + } } return GTK_WIDGET_CLASS (parent_class)->leave_notify_event (widget, event); |