From bbc5aee5e5dc518885d2abdab0430d6f23d334b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Thu, 27 May 2021 19:18:16 +0200 Subject: [PATCH] gestures: add a function to know if there is pending pointer motion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Expósito --- src/evdev-mt-touchpad-gestures.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index dcdb3474..fa8660cb 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -154,6 +154,23 @@ tp_get_raw_pointer_motion(struct tp_dispatch *tp) return raw; } +static bool +tp_has_pending_pointer_motion(struct tp_dispatch *tp, uint64_t time) +{ + struct device_float_coords raw; + + if (!(tp->queued & TOUCHPAD_EVENT_MOTION)) + return false; + + /* Checking for raw pointer motion is enough in this case. + * Calling tp_filter_motion is intentionally omitted to avoid calling + * it twice (here and in tp_gesture_post_pointer_motion) with the same + * event. + */ + raw = tp_get_raw_pointer_motion(tp); + return !device_float_is_zero(raw); +} + static void tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time) {