Fix interaction between scrolling menus and automatic mnemonics

https://bugzilla.gnome.org/show_bug.cgi?id=612611
This commit is contained in:
Matthias Clasen 2010-10-31 15:52:32 -04:00 committed by Tristan Van Berkom
parent ca6398a649
commit 71d6a289fc

View File

@ -238,7 +238,8 @@ static void gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
static void gtk_menu_deactivate (GtkMenuShell *menu_shell); static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
static void gtk_menu_show_all (GtkWidget *widget); static void gtk_menu_show_all (GtkWidget *widget);
static void gtk_menu_position (GtkMenu *menu); static void gtk_menu_position (GtkMenu *menu,
gboolean set_scroll_offset);
static void gtk_menu_reparent (GtkMenu *menu, static void gtk_menu_reparent (GtkMenu *menu,
GtkWidget *new_parent, GtkWidget *new_parent,
gboolean unrealize); gboolean unrealize);
@ -1131,7 +1132,7 @@ menu_change_screen (GtkMenu *menu,
if (menu->torn_off) if (menu->torn_off)
{ {
gtk_window_set_screen (GTK_WINDOW (menu->tearoff_window), new_screen); gtk_window_set_screen (GTK_WINDOW (menu->tearoff_window), new_screen);
gtk_menu_position (menu); gtk_menu_position (menu, TRUE);
} }
gtk_window_set_screen (GTK_WINDOW (menu->toplevel), new_screen); gtk_window_set_screen (GTK_WINDOW (menu->toplevel), new_screen);
@ -1618,7 +1619,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
/* Position the menu, possibly changing the size request /* Position the menu, possibly changing the size request
*/ */
gtk_menu_position (menu); gtk_menu_position (menu, TRUE);
/* Compute the size of the toplevel and realize it so we /* Compute the size of the toplevel and realize it so we
* can scroll correctly. * can scroll correctly.
@ -2011,7 +2012,7 @@ gtk_menu_reposition (GtkMenu *menu)
g_return_if_fail (GTK_IS_MENU (menu)); g_return_if_fail (GTK_IS_MENU (menu));
if (!menu->torn_off && gtk_widget_is_drawable (GTK_WIDGET (menu))) if (!menu->torn_off && gtk_widget_is_drawable (GTK_WIDGET (menu)))
gtk_menu_position (menu); gtk_menu_position (menu, FALSE);
} }
static void static void
@ -2193,7 +2194,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
gtk_menu_set_tearoff_hints (menu, gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (menu)))); gtk_menu_set_tearoff_hints (menu, gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (menu))));
gtk_widget_realize (menu->tearoff_window); gtk_widget_realize (menu->tearoff_window);
gtk_menu_position (menu); gtk_menu_position (menu, TRUE);
gtk_widget_show (GTK_WIDGET (menu)); gtk_widget_show (GTK_WIDGET (menu));
gtk_widget_show (menu->tearoff_window); gtk_widget_show (menu->tearoff_window);
@ -4472,7 +4473,8 @@ gtk_menu_deactivate (GtkMenuShell *menu_shell)
} }
static void static void
gtk_menu_position (GtkMenu *menu) gtk_menu_position (GtkMenu *menu,
gboolean set_scroll_offset)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkRequisition requisition; GtkRequisition requisition;
@ -4704,7 +4706,8 @@ gtk_menu_position (GtkMenu *menu)
requisition.width, requisition.height); requisition.width, requisition.height);
} }
menu->scroll_offset = scroll_offset; if (set_scroll_offset)
menu->scroll_offset = scroll_offset;
} }
static void static void