[gtk/gtk-3-24: 1/3] gtkgesture: Fix get-center for touchpad gestures
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/3] gtkgesture: Fix get-center for touchpad gestures
- Date: Fri, 17 Jan 2020 22:25:24 +0000 (UTC)
commit e229c6fe81c0477622b9e702dc520870546d4697
Author: Yariv Barkan <nushoin users noreply github com>
Date: Tue Dec 17 13:28:17 2019 +0200
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.
gtk/gtkgesture.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index 051c63e129..4bb7715f38 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -1455,12 +1455,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]