From e5ff3129aaf7f30f3ee07ce6ffdd9e011d39d987 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sun, 13 Nov 2011 18:38:12 +0100 Subject: [PATCH] scrolledwindow: Handle nested scrolled windows in kinetic scrolling The innermost scrolled window always gets to capture the events, all scrolled windows above it just let the event go through. Ideally reaching a limit on the innermost scrolled window would propagate the dragging up the hierarchy in order to keep following the touch coords, although that'd involve rather evil hacks just to cater for broken UIs. --- gtk/gtkscrolledwindow.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 976623f71d..5dc05bfbfb 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -2863,6 +2863,14 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget, return FALSE; event = (GdkEventButton *)_event; + event_widget = gtk_get_event_widget (_event); + + /* If there's another scrolled window between the widget + * receiving the event and this capturing scrolled window, + * let it handle the events. + */ + if (widget != gtk_widget_get_ancestor (event_widget, GTK_TYPE_SCROLLED_WINDOW)) + return FALSE; /* Check whether the button press is close to the previous one, * take that as a shortcut to get the child widget handle events @@ -2886,7 +2894,6 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget, if (!child) return FALSE; - event_widget = gtk_get_event_widget (_event); if (priv->hscrollbar == event_widget || priv->vscrollbar == event_widget) return FALSE;