[gtk+/gtk-3-4] Make page up/down work again in scrolled menus
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-4] Make page up/down work again in scrolled menus
- Date: Wed, 2 May 2012 13:03:41 +0000 (UTC)
commit f28c50a182e381cceba35a1991fb5792dd9ecdfc
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 24 23:34:12 2012 -0400
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
gtk/gtkmenu.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index f52d110..8760dcb 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]