[gtk+] gesture zoom: Use GdkEvent API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gesture zoom: Use GdkEvent API
- Date: Tue, 19 Sep 2017 17:16:50 +0000 (UTC)
commit 50701abcc30cd317a15e30e0c9ed65aeff402c98
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 26 10:53:33 2017 -0400
gesture zoom: Use GdkEvent API
gtk/gtkgesturezoom.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkgesturezoom.c b/gtk/gtkgesturezoom.c
index cfc2777..905e6ab 100644
--- a/gtk/gtkgesturezoom.c
+++ b/gtk/gtkgesturezoom.c
@@ -81,6 +81,7 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom,
GtkGesture *gesture;
GList *sequences;
gdouble dx, dy;
+ GdkTouchpadGesturePhase phase;
gesture = GTK_GESTURE (zoom);
@@ -92,14 +93,18 @@ _gtk_gesture_zoom_get_distance (GtkGestureZoom *zoom,
return FALSE;
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
+ gdk_event_get_touchpad_gesture_phase (last_event, &phase);
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
- (last_event->touchpad_pinch.phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
- last_event->touchpad_pinch.phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE ||
- last_event->touchpad_pinch.phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
+ (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
+ phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE ||
+ phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
{
+ double scale;
/* Touchpad pinch */
- *distance = last_event->touchpad_pinch.scale;
+
+ gdk_event_get_touchpad_scale (last_event, &scale);
+ *distance = scale;
}
else
{
@@ -145,7 +150,11 @@ gtk_gesture_zoom_filter_event (GtkEventController *controller,
/* Let 2-finger touchpad pinch events go through */
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_PINCH)
{
- if (event->touchpad_pinch.n_fingers == 2)
+ guint n_fingers;
+
+ gdk_event_get_touchpad_gesture_n_fingers (event, &n_fingers);
+
+ if (n_fingers == 2)
return FALSE;
else
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]