diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-06-10 14:27:14 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-06-10 14:30:58 +0200 |
commit | ba988cd8999c84f9cce13cc4fe5487e05291ab26 (patch) | |
tree | 812e42a41e4fddea3cbcc7d2377e15a60671c558 /gtk/gtkgesturezoom.c | |
parent | d2235b71f372a012468b18d0ea5f59613a20464a (diff) | |
download | gtk+-ba988cd8999c84f9cce13cc4fe5487e05291ab26.tar.gz |
gtkgesturezoom: Do not check touchpad phase on generic events
This gesture handles both individual touch events and touchpad gesture
events, and was checking the touchpad phase in generic code paths. This
is dubious since event methods error out on the wrong GdkEventTypes.
Check the touchpad gesture phase within the branch handling touchpad
events, and make it clear which is the gesture phase of all that we are
ignoring.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2825
Diffstat (limited to 'gtk/gtkgesturezoom.c')
-rw-r--r-- | gtk/gtkgesturezoom.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gtk/gtkgesturezoom.c b/gtk/gtkgesturezoom.c index 83f8e3a276..d706b502f3 100644 --- a/gtk/gtkgesturezoom.c +++ b/gtk/gtkgesturezoom.c @@ -94,15 +94,15 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom, goto out; last_event = gtk_gesture_get_last_event (gesture, sequences->data); - phase = gdk_touchpad_event_get_gesture_phase (last_event); - if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH && - (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN || - phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE || - phase == GDK_TOUCHPAD_GESTURE_PHASE_END)) + if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH) { double scale; + /* Touchpad pinch */ + phase = gdk_touchpad_event_get_gesture_phase (last_event); + if (phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL) + goto out; scale = gdk_touchpad_event_get_pinch_scale (last_event); *distance = scale; |