diff options
author | Yariv Barkan <nushoin@users.noreply.github.com> | 2019-12-17 13:28:17 +0200 |
---|---|---|
committer | Yariv Barkan <21448-yarivb@users.noreply.gitlab.gnome.org> | 2020-01-17 22:34:48 +0200 |
commit | 00a488a5b5d3bb8a9c5c755bba4152b190861a08 (patch) | |
tree | b96034d486416a2e4a39b2c8f15359165c7ecb19 /gtk/gtkgesture.c | |
parent | 26c4c2806838622e27337c25c8d9ae615de89c48 (diff) | |
download | gtk+-00a488a5b5d3bb8a9c5c755bba4152b190861a08.tar.gz |
gtkgesture: Fix get-center for touchpad gestures
Touchpad gestures have only a single event sequence. The current
'center' of the gesture is the starting point + accumulated deltas.
Update gtk_gesture_get_bounding_box_center() accordingly.
Diffstat (limited to 'gtk/gtkgesture.c')
-rw-r--r-- | gtk/gtkgesture.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c index 165936d7c7..5e95de0cf9 100644 --- a/gtk/gtkgesture.c +++ b/gtk/gtkgesture.c @@ -1335,12 +1335,19 @@ gtk_gesture_get_bounding_box_center (GtkGesture *gesture, gdouble *x, gdouble *y) { + const GdkEvent *last_event; GdkRectangle rect; + GdkEventSequence *sequence; g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE); g_return_val_if_fail (x != NULL && y != NULL, FALSE); - if (!gtk_gesture_get_bounding_box (gesture, &rect)) + sequence = gtk_gesture_get_last_updated_sequence (gesture); + last_event = gtk_gesture_get_last_event (gesture, sequence); + + if (EVENT_IS_TOUCHPAD_GESTURE (last_event)) + return gtk_gesture_get_point (gesture, sequence, x, y); + else if (!gtk_gesture_get_bounding_box (gesture, &rect)) return FALSE; *x = rect.x + rect.width / 2; |