[PATCH libinput 5/6] touchpad: add helper function for stopping current actions

Peter Hutterer peter.hutterer at who-t.net
Fri Apr 21 00:05:20 UTC 2017


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 21fdc46..f41dd68 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -276,6 +276,14 @@ tp_end_sequence(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
 	tp_end_touch(tp, t, time);
 }
 
+static void
+tp_stop_actions(struct tp_dispatch *tp, uint64_t time)
+{
+	tp_edge_scroll_stop_events(tp, time);
+	tp_gesture_cancel(tp, time);
+	tp_tap_suspend(tp, time);
+}
+
 struct normalized_coords
 tp_get_delta(struct tp_touch *t)
 {
@@ -1395,9 +1403,7 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data)
 		return;
 
 	if (!tp->palm.trackpoint_active) {
-		tp_edge_scroll_stop_events(tp, time);
-		tp_gesture_cancel(tp, time);
-		tp_tap_suspend(tp, time);
+		tp_stop_actions(tp, time);
 		tp->palm.trackpoint_active = true;
 	}
 
@@ -1510,9 +1516,7 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
 				     ARRAY_LENGTH(tp->dwt.mod_mask)))
 		    return;
 
-		tp_edge_scroll_stop_events(tp, time);
-		tp_gesture_cancel(tp, time);
-		tp_tap_suspend(tp, time);
+		tp_stop_actions(tp, time);
 		tp->dwt.keyboard_active = true;
 		timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1;
 	} else {
-- 
2.9.3



More information about the wayland-devel mailing list