[PATCH libinput 06/11] touchpad: split tp_gesture_stop into stop and cancel

Peter Hutterer peter.hutterer at who-t.net
Thu Jul 2 21:15:44 PDT 2015


No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad-gestures.c | 22 +++++++++++++++++-----
 src/evdev-mt-touchpad.c          |  6 +++---
 src/evdev-mt-touchpad.h          |  5 ++++-
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 840d9ad..90835d7 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -422,7 +422,7 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time)
 
 	/* When tap-and-dragging, or a clickpad is clicked force 1fg mode */
 	if (tp_tap_dragging(tp) || (tp->buttons.is_clickpad && tp->buttons.state)) {
-		tp_gesture_stop(tp, time, 1);
+		tp_gesture_cancel(tp, time);
 		tp->gesture.finger_count = 1;
 		tp->gesture.finger_count_pending = 0;
 	}
@@ -456,8 +456,8 @@ tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
 			  LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
 }
 
-void
-tp_gesture_stop(struct tp_dispatch *tp, uint64_t time, int cancelled)
+static void
+tp_gesture_end(struct tp_dispatch *tp, uint64_t time, bool cancelled)
 {
 	struct libinput *libinput = tp->device->base.seat->libinput;
 	enum tp_gesture_2fg_state twofinger_state = tp->gesture.twofinger_state;
@@ -494,6 +494,18 @@ tp_gesture_stop(struct tp_dispatch *tp, uint64_t time, int cancelled)
 	tp->gesture.started = false;
 }
 
+void
+tp_gesture_cancel(struct tp_dispatch *tp, uint64_t time)
+{
+	tp_gesture_end(tp, time, true);
+}
+
+void
+tp_gesture_stop(struct tp_dispatch *tp, uint64_t time)
+{
+	tp_gesture_end(tp, time, false);
+}
+
 static void
 tp_gesture_finger_count_switch_timeout(uint64_t now, void *data)
 {
@@ -502,7 +514,7 @@ tp_gesture_finger_count_switch_timeout(uint64_t now, void *data)
 	if (!tp->gesture.finger_count_pending)
 		return;
 
-	tp_gesture_stop(tp, now, 1); /* End current gesture */
+	tp_gesture_cancel(tp, now); /* End current gesture */
 	tp->gesture.finger_count = tp->gesture.finger_count_pending;
 	tp->gesture.finger_count_pending = 0;
 }
@@ -520,7 +532,7 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time)
 	if (active_touches != tp->gesture.finger_count) {
 		/* If all fingers are lifted immediately end the gesture */
 		if (active_touches == 0) {
-			tp_gesture_stop(tp, time, 0);
+			tp_gesture_stop(tp, time);
 			tp->gesture.finger_count = 0;
 			tp->gesture.finger_count_pending = 0;
 		/* Immediately switch to new mode to avoid initial latency */
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index fac2e4d..e90bd1e 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -797,7 +797,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time)
 	    tp->palm.trackpoint_active ||
 	    tp->dwt.keyboard_active) {
 		tp_edge_scroll_stop_events(tp, time);
-		tp_gesture_stop(tp, time, 1);
+		tp_gesture_cancel(tp, time);
 		return;
 	}
 
@@ -976,7 +976,7 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data)
 
 	if (!tp->palm.trackpoint_active) {
 		tp_edge_scroll_stop_events(tp, time);
-		tp_gesture_stop(tp, time, 1);
+		tp_gesture_cancel(tp, time);
 		tp_tap_suspend(tp, time);
 		tp->palm.trackpoint_active = true;
 	}
@@ -1053,7 +1053,7 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
 
 	if (!tp->dwt.keyboard_active) {
 		tp_edge_scroll_stop_events(tp, time);
-		tp_gesture_stop(tp, time, 1);
+		tp_gesture_cancel(tp, time);
 		tp_tap_suspend(tp, time);
 		tp->dwt.keyboard_active = true;
 		timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index b8a8712..df8be94 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -447,7 +447,10 @@ void
 tp_remove_gesture(struct tp_dispatch *tp);
 
 void
-tp_gesture_stop(struct tp_dispatch *tp, uint64_t time, int cancelled);
+tp_gesture_stop(struct tp_dispatch *tp, uint64_t time);
+
+void
+tp_gesture_cancel(struct tp_dispatch *tp, uint64_t time);
 
 void
 tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time);
-- 
2.4.3



More information about the wayland-devel mailing list