[gtk+/composite-templates] menu: Fix touch scrolling on menus close to the monitor edge



commit b4c4e2039c95e53bae4e33a26221072b0428bd96
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Jul 13 15:03:30 2012 +0200

    menu: Fix touch scrolling on menus close to the monitor edge
    
    Specially in the case of comboboxes, those menus could enable scrolling
    even if the contents could fit in the work area, and could show blank
    space in order to line up the selected item with the combobox.
    
    When such thing happens, take into account scroll_offset when relocating
    the menu contents so contents don't jump directly onscreen, and apply
    it so scrolling is allowed in the direction that brings the menu onscreen
    and blocked in the opposite direction.
    
    Also, wait for cancelling the scroll operation until the touch is released
    even if the scrolling arrows disappeared, so the menu item underneath isn't
    selected right away.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678113

 gtk/gtkmenu.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index a5d3801..9f0bfee 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -4279,7 +4279,7 @@ gtk_menu_captured_event (GtkWidget *widget,
   menu = GTK_MENU (widget);
   priv = menu->priv;
 
-  if (!priv->upper_arrow_visible && !priv->lower_arrow_visible)
+  if (!priv->upper_arrow_visible && !priv->lower_arrow_visible && priv->drag_start_y < 0)
     return retval;
 
   source_device = gdk_event_get_source_device (event);
@@ -4352,7 +4352,10 @@ gtk_menu_captured_event (GtkWidget *widget,
               if (priv->lower_arrow_visible)
                 view_height -= arrow_border.bottom;
 
-              offset = CLAMP (offset, 0, priv->requested_height - view_height);
+              offset = CLAMP (offset,
+                              MIN (priv->scroll_offset, 0),
+                              MAX (priv->scroll_offset, priv->requested_height - view_height));
+
               gtk_menu_scroll_to (menu, offset);
 
               retval = TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]