diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2015-05-22 10:09:22 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-05-26 10:53:23 +1000 |
commit | 18999667caaa024f8f6ce3e8a8ae0b615d176a27 (patch) | |
tree | 33c8833fc6d632b2426175594feff6c8a493d1c4 | |
parent | e819bd131e57d5a1f012652e5630b14428b2e2b3 (diff) | |
download | libinput-18999667caaa024f8f6ce3e8a8ae0b615d176a27.tar.gz |
touchpad: split tp_gesture_stop into stop and cancel
No functional changes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/evdev-mt-touchpad-gestures.c | 22 | ||||
-rw-r--r-- | src/evdev-mt-touchpad.c | 6 | ||||
-rw-r--r-- | 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 a0182ed8..b270b3e5 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -417,7 +417,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; } @@ -451,8 +451,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; @@ -489,6 +489,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) { @@ -497,7 +509,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; } @@ -515,7 +527,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 4213ca59..787df8ad 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -719,7 +719,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) tp->sendevents.trackpoint_active || tp->sendevents.keyboard_active) { tp_edge_scroll_stop_events(tp, time); - tp_gesture_stop(tp, time, 1); + tp_gesture_cancel(tp, time); return; } @@ -897,7 +897,7 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data) if (!tp->sendevents.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->sendevents.trackpoint_active = true; } @@ -949,7 +949,7 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data) if (!tp->sendevents.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->sendevents.keyboard_active = true; timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1; diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index e396b3c3..f12dc87a 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -412,7 +412,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); |