[gnome-photos] preview-nav-buttons: Handle touch events during the capture phase



commit fd7bbbb5777c4d049c6f3e0917cb6b0df6acd8f1
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 15 12:07:38 2017 +0200

    preview-nav-buttons: Handle touch events during the capture phase
    
    Single touch gestures are delivered with
    GdkEventTouch:emulating_pointer set to TRUE. Once the event reaches
    the target phase, GtkWidget::button-press/release-events will be
    emitted on ImageView. These signal handlers are not equipped to
    differentiate between quick taps, long presses and drags. They will
    interpret quick taps as an attempt to drag and pan the view, and as a
    result the GtkGestures won't receive the events afterwards.
    
    Therefore, the touch events need to be fed to the GtkGestures before
    they reach the target phase so that quick taps may be detected before
    the GtkWidget::button-press/release-events handlers step in.
    
    Fallout from b121e86bcdb1ba3bd55754e676b0c7a4cba9d116
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742662

 src/photos-preview-nav-buttons.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index 90bfbc2..e7247c2 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -463,6 +463,7 @@ photos_preview_nav_buttons_constructed (GObject *object)
                             self);
 
   self->long_press_gesture = gtk_gesture_long_press_new (self->preview_view);
+  gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (self->long_press_gesture), 
GTK_PHASE_CAPTURE);
   gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (self->long_press_gesture), TRUE);
   g_signal_connect_swapped (self->long_press_gesture,
                             "pressed",
@@ -470,6 +471,7 @@ photos_preview_nav_buttons_constructed (GObject *object)
                             self);
 
   self->tap_gesture = gtk_gesture_multi_press_new (self->preview_view);
+  gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (self->tap_gesture), GTK_PHASE_CAPTURE);
   gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (self->tap_gesture), TRUE);
   gtk_gesture_group (self->long_press_gesture, self->tap_gesture);
   g_signal_connect_swapped (self->tap_gesture,


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