[gtk+/touchscreens: 34/49] scrolledwindow: Handle nested scrolled windows in kinetic scrolling
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touchscreens: 34/49] scrolledwindow: Handle nested scrolled windows in kinetic scrolling
- Date: Mon, 5 Dec 2011 01:17:49 +0000 (UTC)
commit 960e4776af9ad2abada64e2837cd57dcf09ddb90
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Nov 13 18:38:12 2011 +0100
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 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 2f10709..f0b7181 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2912,11 +2912,19 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget,
return GTK_CAPTURED_EVENT_NONE;
event = (GdkEventButton *)_event;
+ event_widget = gtk_get_event_widget (_event);
if (!priv->vscrollbar_visible &&
!priv->hscrollbar_visible)
return GTK_CAPTURED_EVENT_NONE;
+ /* 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 GTK_CAPTURED_EVENT_NONE;
+
/* Check whether the button press is close to the previous one,
* take that as a shortcut to get the child widget handle events
*/
@@ -2938,7 +2946,6 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget,
if (!child)
return GTK_CAPTURED_EVENT_NONE;
- event_widget = gtk_get_event_widget (_event);
if (priv->hscrollbar == event_widget || priv->vscrollbar == event_widget)
return GTK_CAPTURED_EVENT_NONE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]