Commit 87cd4937 authored by Matthias Clasen's avatar Matthias Clasen

Make page up/down work again in scrolled menus

This was broken since before GTK+ 3.0, when we replaced
a use of requisition by allocation. Fix this by using the
requisition height, that is already cached by the menu code.

The math is not quite right here; if you page all the way
down a long menu, you end up on the second-to-last menuitem.
But at least, page up/down let you move up and down the menu
again.
https://bugzilla.gnome.org/show_bug.cgi?id=668931
parent 2e873e3f
......@@ -5528,15 +5528,13 @@ static gint
get_menu_height (GtkMenu *menu)
{
GtkMenuPrivate *priv = menu->priv;
GtkAllocation allocation;
GtkWidget *widget = GTK_WIDGET (menu);
GtkBorder padding;
gint height;
gtk_widget_get_allocation (widget, &allocation);
get_menu_padding (widget, &padding);
height = allocation.height;
height = priv->requested_height;
height -= (gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2) +
padding.top + padding.bottom;
......@@ -5600,6 +5598,7 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
GtkWidget *new_child;
gboolean new_upper_arrow_visible = priv->upper_arrow_visible && !priv->tearoff_active;
GtkBorder arrow_border;
get_arrows_border (menu, &arrow_border);
if (priv->scroll_offset != old_offset)
......@@ -5616,13 +5615,11 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
case GTK_SCROLL_START:
/* Ignore the enter event we might get if the pointer is on the menu */
menu_shell->priv->ignore_enter = TRUE;
gtk_menu_scroll_to (menu, 0);
gtk_menu_shell_select_first (menu_shell, TRUE);
break;
case GTK_SCROLL_END:
/* Ignore the enter event we might get if the pointer is on the menu */
menu_shell->priv->ignore_enter = TRUE;
gtk_menu_scroll_to (menu, end_position - page_size);
_gtk_menu_shell_select_last (menu_shell, TRUE);
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment