From ba3e79c9f40711ed19df1df351e820aace823ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Tue, 1 Jun 2021 19:11:19 +0200 Subject: [PATCH] gestures: refactor gesture enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the condition to check if gestures are enabled to its own function. Signed-off-by: José Expósito --- src/evdev-mt-touchpad-gestures.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index fa8660cb..d6c0b4bb 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -957,6 +957,12 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time) } } +static bool +tp_gesture_are_gestures_enabled(struct tp_dispatch *tp) +{ + return (!tp->semi_mt && tp->num_slots > 1); +} + void tp_init_gesture(struct tp_dispatch *tp) { @@ -965,7 +971,7 @@ tp_init_gesture(struct tp_dispatch *tp) /* two-finger scrolling is always enabled, this flag just * decides whether we detect pinch. semi-mt devices are too * unreliable to do pinch gestures. */ - tp->gesture.enabled = !tp->semi_mt && tp->num_slots > 1; + tp->gesture.enabled = tp_gesture_are_gestures_enabled(tp); tp->gesture.state = GESTURE_STATE_NONE;