From 45e6e28ca24805f1d46d5ef03d9c261ed1adb0c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Mon, 31 May 2021 17:58:11 +0200 Subject: [PATCH] gestures: move first_moved and first_mm up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the calculation of first_moved and first_mm up inside tp_gesture_detect_motion_gestures in order to be able to use their values in the one finger code path. Signed-off-by: José Expósito --- src/evdev-mt-touchpad-gestures.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 01bd53da..0022cd3b 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -811,6 +811,9 @@ tp_gesture_detect_motion_gestures(struct tp_dispatch *tp, uint64_t time) double min_move = 1.5; /* min movement threshold in mm - count this touch */ double max_move = 4.0; /* max movement threshold in mm - ignore other touch */ + first_moved = tp_gesture_mm_moved(tp, first); + first_mm = hypot(first_moved.x, first_moved.y); + if (tp->gesture.finger_count == 1) { if (tp_has_pending_pointer_motion(tp, time)) { tp_gesture_handle_event(tp, @@ -832,9 +835,6 @@ tp_gesture_detect_motion_gestures(struct tp_dispatch *tp, uint64_t time) max_move += 2.0 * (tp->gesture.finger_count - 2); min_move += 0.5 * (tp->gesture.finger_count - 2); - first_moved = tp_gesture_mm_moved(tp, first); - first_mm = hypot(first_moved.x, first_moved.y); - second_moved = tp_gesture_mm_moved(tp, second); second_mm = hypot(second_moved.x, second_moved.y);