[gtk+/gestures: 51/92] scrolledwindow: Ensure the dragging sequence gets denied if more touches come in
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures: 51/92] scrolledwindow: Ensure the dragging sequence gets denied if more touches come in
- Date: Tue, 8 Apr 2014 19:44:42 +0000 (UTC)
commit 406341c37800e44f1eb7fc9b9518c979e5ca1f6e
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Mar 26 14:06:09 2014 +0100
scrolledwindow: Ensure the dragging sequence gets denied if more touches come in
This allows children to receive an emulated press, and handle it together with
the new touch that made the scrolledwindow sequence denied.
gtk/gtkscrolledwindow.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index a935885..76892ba 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -656,15 +656,14 @@ scrolled_window_drag_end_cb (GtkScrolledWindow *scrolled_window,
GtkGesture *gesture)
{
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
+ GdkEventSequence *current, *last;
- if (!priv->in_drag)
- {
- GdkEventSequence *sequence;
+ current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
+ last = gtk_gesture_get_last_updated_sequence (gesture);
- sequence = gtk_gesture_get_last_updated_sequence (gesture);
- gtk_widget_set_sequence_state (GTK_WIDGET (scrolled_window),
- sequence, GTK_EVENT_SEQUENCE_DENIED);
- }
+ if (!priv->in_drag || current != last)
+ gtk_widget_set_sequence_state (GTK_WIDGET (scrolled_window),
+ current, GTK_EVENT_SEQUENCE_DENIED);
}
static void
@@ -716,8 +715,11 @@ scrolled_window_long_press_cancelled_cb (GtkScrolledWindow *scrolled_window,
sequence = gtk_gesture_get_last_updated_sequence (gesture);
event = gtk_gesture_get_last_event (gesture, sequence);
- if (event->type != GDK_TOUCH_END &&
- event->type != GDK_BUTTON_RELEASE)
+ if (event->type == GDK_TOUCH_BEGIN)
+ gtk_widget_set_gesture_state (GTK_WIDGET (scrolled_window), gesture,
+ GTK_EVENT_SEQUENCE_DENIED);
+ else if (event->type != GDK_TOUCH_END &&
+ event->type != GDK_BUTTON_RELEASE)
priv->in_drag = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]