[gtk+/wip/baedert/drawing: 241/241] scrolledwindow: Fix on_scrollbar check



commit 7a488297dfeb7090fccc44fa7fa4ce496d58ec19
Author: Timm Bäder <mail baedert org>
Date:   Thu Jun 15 12:49:31 2017 +0200

    scrolledwindow: Fix on_scrollbar check
    
    The event widget is always the toplevel window, so use the event target
    and check the GtkScrollbar ancestor.

 gtk/gtkscrolledwindow.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index e48a6e6..7d7a939 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1274,7 +1274,8 @@ captured_event_cb (GtkWidget *widget,
   GtkScrolledWindow *sw;
   GdkInputSource input_source;
   GdkDevice *source_device;
-  GtkWidget *event_widget;
+  GtkWidget *event_target;
+  GtkWidget *event_target_ancestor;
   gboolean on_scrollbar;
 
   sw = GTK_SCROLLED_WINDOW (widget);
@@ -1300,9 +1301,10 @@ captured_event_cb (GtkWidget *widget,
       input_source == GDK_SOURCE_TOUCHSCREEN)
     return GDK_EVENT_PROPAGATE;
 
-  event_widget = gtk_get_event_widget (event);
-  on_scrollbar = (event_widget == priv->hindicator.scrollbar ||
-                  event_widget == priv->vindicator.scrollbar);
+  event_target = gtk_get_event_target (event);
+  event_target_ancestor = gtk_widget_get_ancestor (event_target, GTK_TYPE_SCROLLBAR);
+  on_scrollbar = (event_target_ancestor == priv->hindicator.scrollbar ||
+                  event_target_ancestor == priv->vindicator.scrollbar);
 
   if (event->type == GDK_MOTION_NOTIFY)
     {


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