[gnome-photos/gnome-3-22] preview-nav-buttons: Fix the logic to avoid long presses
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/gnome-3-22] preview-nav-buttons: Fix the logic to avoid long presses
- Date: Thu, 8 Dec 2016 06:36:29 +0000 (UTC)
commit 3229f7b09762a4cb1245af412416a7c30740b492
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Nov 27 13:24:11 2016 +0100
preview-nav-buttons: Fix the logic to avoid long presses
GtkGestureMultiPress::released is emitted, and it is meant to be, even
after we denied all the sequences in GtkGestureLongPress::pressed.
Therefore, we were toggling the overlay even on a long press.
We are supposed to check the state of the sequence ourselves, and to
do that we need access to the GdkEventSequence object. Hence, we now
connect to GtkGesture::end instead of GtkGestureMultiPress::released.
src/photos-preview-nav-buttons.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index 28c9751..aaf61ba 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -281,8 +281,14 @@ photos_preview_nav_buttons_long_press_pressed (PhotosPreviewNavButtons *self)
static void
-photos_preview_nav_buttons_multi_press_released (PhotosPreviewNavButtons *self)
+photos_preview_nav_buttons_multi_press_end (PhotosPreviewNavButtons *self, GdkEventSequence *sequence)
{
+ GtkEventSequenceState state;
+
+ state = gtk_gesture_get_sequence_state (self->tap_gesture, sequence);
+ if (state == GTK_EVENT_SEQUENCE_DENIED)
+ return;
+
gtk_gesture_set_state (GTK_GESTURE (self->tap_gesture), GTK_EVENT_SEQUENCE_CLAIMED);
self->visible_internal = !self->visible_internal;
photos_preview_nav_buttons_unqueue_auto_hide (self);
@@ -467,8 +473,8 @@ photos_preview_nav_buttons_constructed (GObject *object)
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,
- "released",
- G_CALLBACK (photos_preview_nav_buttons_multi_press_released),
+ "end",
+ G_CALLBACK (photos_preview_nav_buttons_multi_press_end),
self);
/* We will not need them any more */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]