mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-05 14:50:15 +01:00
touchpad: split tp_gesture_stop into stop and cancel
No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
9fae0f8c3e
commit
7f6fe7351d
3 changed files with 24 additions and 9 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue