[gtk+] GtkScrolledWindow: Do not hover one scrollbar if grabbing on the other



commit 0b840a04a2b86122a036754e1c6c131fc2b4d7c6
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Mar 14 18:47:37 2016 +0100

    GtkScrolledWindow: Do not hover one scrollbar if grabbing on the other
    
    Makes no sense since we're not going to interact with it. It'll be
    hovered eventually if the button is released.

 gtk/gtkscrolledwindow.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 2d29d65..8a98490 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1167,7 +1167,8 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
                                   Indicator         *indicator,
                                   GdkEvent          *event)
 {
-  gboolean indicator_close, on_scrollbar;
+  GtkScrolledWindowPrivate *priv = sw->priv;
+  gboolean indicator_close, on_scrollbar, on_other_scrollbar;
   GtkWidget *event_widget;
 
   event_widget = gtk_get_event_widget (event);
@@ -1175,6 +1176,10 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
   indicator_close = event_close_to_indicator (sw, indicator, event);
   on_scrollbar = (event_widget == indicator->scrollbar &&
                   event->type != GDK_LEAVE_NOTIFY);
+  on_other_scrollbar = (!on_scrollbar &&
+                        event->type != GDK_LEAVE_NOTIFY &&
+                        (event_widget == priv->hindicator.scrollbar ||
+                         event_widget == priv->vindicator.scrollbar));
 
   if (indicator->over_timeout_id)
     {
@@ -1184,7 +1189,7 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
 
   if (on_scrollbar)
     indicator_set_over (indicator, TRUE);
-  else if (indicator_close)
+  else if (indicator_close && !on_other_scrollbar)
     indicator->over_timeout_id = gdk_threads_add_timeout (30, enable_over_timeout_cb, indicator);
   else
     indicator_set_over (indicator, FALSE);


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