gestures: add hold gesture implementation

Hold gestures are notifications about fingers on the touchpad.
There is no coordinate attached to a hold gesture, merely the number of fingers.
A hold gesture starts when the user places a finger on the touchpad and
ends when all fingers are lifted. It is cancelled when the finger(s) move
past applicable thresholds and trigger some other interaction like pointer
movement or scrolling.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
This commit is contained in:
José Expósito 2021-05-27 19:20:03 +02:00 committed by Peter Hutterer
parent 279d14b392
commit 8a180b52d6
9 changed files with 365 additions and 33 deletions

View file

@ -28,6 +28,7 @@
#include "evdev-mt-touchpad.h"
#define DEFAULT_GESTURE_HOLD_TIMEOUT ms2us(180)
#define DEFAULT_GESTURE_SWITCH_TIMEOUT ms2us(100)
#define DEFAULT_GESTURE_SWIPE_TIMEOUT ms2us(150)
#define DEFAULT_GESTURE_PINCH_TIMEOUT ms2us(300)
@ -37,6 +38,7 @@
enum gesture_event {
GESTURE_EVENT_RESET,
GESTURE_EVENT_FINGER_DETECTED,
GESTURE_EVENT_HOLD_TIMEOUT,
GESTURE_EVENT_POINTER_MOTION,
GESTURE_EVENT_SCROLL,
GESTURE_EVENT_SWIPE,
@ -49,6 +51,7 @@ gesture_state_to_str(enum tp_gesture_state state)
switch (state) {
CASE_RETURN_STRING(GESTURE_STATE_NONE);
CASE_RETURN_STRING(GESTURE_STATE_UNKNOWN);
CASE_RETURN_STRING(GESTURE_STATE_HOLD);
CASE_RETURN_STRING(GESTURE_STATE_POINTER_MOTION);
CASE_RETURN_STRING(GESTURE_STATE_SCROLL);
CASE_RETURN_STRING(GESTURE_STATE_PINCH);
@ -63,6 +66,7 @@ gesture_event_to_str(enum gesture_event event)
switch(event) {
CASE_RETURN_STRING(GESTURE_EVENT_RESET);
CASE_RETURN_STRING(GESTURE_EVENT_FINGER_DETECTED);
CASE_RETURN_STRING(GESTURE_EVENT_HOLD_TIMEOUT);
CASE_RETURN_STRING(GESTURE_EVENT_POINTER_MOTION);
CASE_RETURN_STRING(GESTURE_EVENT_SCROLL);
CASE_RETURN_STRING(GESTURE_EVENT_SWIPE);
@ -144,6 +148,10 @@ tp_gesture_start(struct tp_dispatch *tp, uint64_t time)
"%s in unknown gesture mode\n",
__func__);
break;
case GESTURE_STATE_HOLD:
gesture_notify_hold(&tp->device->base, time,
tp->gesture.finger_count);
break;
case GESTURE_STATE_SCROLL:
tp_gesture_init_scroll(tp);
break;
@ -468,22 +476,70 @@ log_gesture_bug(struct tp_dispatch *tp, enum gesture_event event)
gesture_state_to_str(tp->gesture.state));
}
static bool
tp_gesture_use_hold_timer(struct tp_dispatch *tp)
{
/* When tap is not enabled, always use the timer */
if (!tp->tap.enabled)
return true;
/* If the number of fingers on the touchpad exceeds the number of
* allowed fingers to tap, use the timer.
*/
if (tp->gesture.finger_count > 3)
return true;
/* If the tap state machine is already in a hold status, for example
* when holding with 3 fingers and then holding with 2, use the timer.
*/
if (tp->tap.state == TAP_STATE_HOLD ||
tp->tap.state == TAP_STATE_TOUCH_2_HOLD ||
tp->tap.state == TAP_STATE_TOUCH_3_HOLD)
return true;
/* If the tap state machine is in dead status, use the timer. This
* happens when the user holds after cancelling a gesture/scroll.
*/
if (tp->tap.state == TAP_STATE_DEAD)
return true;
/* Otherwise, sync the hold notification with the tap state machine */
return false;
}
static void
tp_gesture_set_hold_timer(struct tp_dispatch *tp, uint64_t time)
{
if (!tp->gesture.hold_enabled)
return;
if (tp_gesture_use_hold_timer(tp)) {
libinput_timer_set(&tp->gesture.hold_timer,
time + DEFAULT_GESTURE_HOLD_TIMEOUT);
}
}
static void
tp_gesture_none_handle_event(struct tp_dispatch *tp,
enum gesture_event event,
uint64_t time)
{
switch(event) {
case GESTURE_EVENT_RESET:
libinput_timer_cancel(&tp->gesture.hold_timer);
break;
case GESTURE_EVENT_FINGER_DETECTED:
tp_gesture_set_hold_timer(tp, time);
tp->gesture.state = GESTURE_STATE_UNKNOWN;
break;
case GESTURE_EVENT_HOLD_TIMEOUT:
break;
case GESTURE_EVENT_POINTER_MOTION:
tp->gesture.state = GESTURE_STATE_POINTER_MOTION;
break;
case GESTURE_EVENT_SCROLL:
tp->gesture.state = GESTURE_STATE_SCROLL;
break;
case GESTURE_EVENT_RESET:
case GESTURE_EVENT_SWIPE:
case GESTURE_EVENT_PINCH:
log_gesture_bug(tp, event);
@ -498,22 +554,66 @@ tp_gesture_unknown_handle_event(struct tp_dispatch *tp,
{
switch(event) {
case GESTURE_EVENT_RESET:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_NONE;
break;
case GESTURE_EVENT_HOLD_TIMEOUT:
tp->gesture.state = GESTURE_STATE_HOLD;
tp_gesture_start(tp, time);
break;
case GESTURE_EVENT_POINTER_MOTION:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_POINTER_MOTION;
break;
case GESTURE_EVENT_SCROLL:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp_gesture_set_scroll_buildup(tp);
tp->gesture.state = GESTURE_STATE_SCROLL;
break;
case GESTURE_EVENT_SWIPE:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_SWIPE;
break;
case GESTURE_EVENT_PINCH:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp_gesture_init_pinch(tp);
tp->gesture.state = GESTURE_STATE_PINCH;
break;
case GESTURE_EVENT_FINGER_DETECTED:
log_gesture_bug(tp, event);
break;
}
}
static void
tp_gesture_hold_handle_event(struct tp_dispatch *tp,
enum gesture_event event,
uint64_t time)
{
switch(event) {
case GESTURE_EVENT_RESET:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_NONE;
break;
case GESTURE_EVENT_POINTER_MOTION:
tp_gesture_cancel(tp, time);
tp->gesture.state = GESTURE_STATE_POINTER_MOTION;
break;
case GESTURE_EVENT_SCROLL:
tp_gesture_set_scroll_buildup(tp);
tp_gesture_cancel(tp, time);
tp->gesture.state = GESTURE_STATE_SCROLL;
break;
case GESTURE_EVENT_SWIPE:
tp_gesture_cancel(tp, time);
tp->gesture.state = GESTURE_STATE_SWIPE;
break;
case GESTURE_EVENT_PINCH:
tp_gesture_init_pinch(tp);
tp_gesture_cancel(tp, time);
tp->gesture.state = GESTURE_STATE_PINCH;
break;
case GESTURE_EVENT_HOLD_TIMEOUT:
case GESTURE_EVENT_FINGER_DETECTED:
log_gesture_bug(tp, event);
break;
@ -527,9 +627,11 @@ tp_gesture_pointer_motion_handle_event(struct tp_dispatch *tp,
{
switch(event) {
case GESTURE_EVENT_RESET:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_NONE;
break;
case GESTURE_EVENT_FINGER_DETECTED:
case GESTURE_EVENT_HOLD_TIMEOUT:
case GESTURE_EVENT_POINTER_MOTION:
case GESTURE_EVENT_SCROLL:
case GESTURE_EVENT_SWIPE:
@ -546,9 +648,11 @@ tp_gesture_scroll_handle_event(struct tp_dispatch *tp,
{
switch(event) {
case GESTURE_EVENT_RESET:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_NONE;
break;
case GESTURE_EVENT_FINGER_DETECTED:
case GESTURE_EVENT_HOLD_TIMEOUT:
case GESTURE_EVENT_POINTER_MOTION:
case GESTURE_EVENT_SCROLL:
case GESTURE_EVENT_SWIPE:
@ -565,9 +669,11 @@ tp_gesture_pinch_handle_event(struct tp_dispatch *tp,
{
switch(event) {
case GESTURE_EVENT_RESET:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_NONE;
break;
case GESTURE_EVENT_FINGER_DETECTED:
case GESTURE_EVENT_HOLD_TIMEOUT:
case GESTURE_EVENT_POINTER_MOTION:
case GESTURE_EVENT_SCROLL:
case GESTURE_EVENT_SWIPE:
@ -584,9 +690,11 @@ tp_gesture_swipe_handle_event(struct tp_dispatch *tp,
{
switch(event) {
case GESTURE_EVENT_RESET:
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_NONE;
break;
case GESTURE_EVENT_FINGER_DETECTED:
case GESTURE_EVENT_HOLD_TIMEOUT:
case GESTURE_EVENT_POINTER_MOTION:
case GESTURE_EVENT_SCROLL:
case GESTURE_EVENT_SWIPE:
@ -612,6 +720,9 @@ tp_gesture_handle_event(struct tp_dispatch *tp,
case GESTURE_STATE_UNKNOWN:
tp_gesture_unknown_handle_event(tp, event, time);
break;
case GESTURE_STATE_HOLD:
tp_gesture_hold_handle_event(tp, event, time);
break;
case GESTURE_STATE_POINTER_MOTION:
tp_gesture_pointer_motion_handle_event(tp, event, time);
break;
@ -635,6 +746,22 @@ tp_gesture_handle_event(struct tp_dispatch *tp,
}
}
static void
tp_gesture_hold_timeout(uint64_t now, void *data)
{
struct tp_dispatch *tp = data;
tp_gesture_handle_event(tp, GESTURE_EVENT_HOLD_TIMEOUT, now);
}
void
tp_gesture_tap_timeout(struct tp_dispatch *tp, uint64_t time)
{
if (!tp->gesture.hold_enabled)
return;
tp_gesture_handle_event(tp, GESTURE_EVENT_HOLD_TIMEOUT, time);
}
static void
tp_gesture_detect_motion_gestures(struct tp_dispatch *tp, uint64_t time)
{
@ -886,6 +1013,16 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time,
tp_gesture_detect_motion_gestures(tp, time);
}
static void
tp_gesture_handle_state_hold(struct tp_dispatch *tp, uint64_t time,
bool ignore_motion)
{
tp_gesture_start(tp, time);
if (!ignore_motion)
tp_gesture_detect_motion_gestures(tp, time);
}
static void
tp_gesture_handle_state_pointer_motion(struct tp_dispatch *tp, uint64_t time)
{
@ -994,6 +1131,9 @@ tp_gesture_post_gesture(struct tp_dispatch *tp, uint64_t time,
if (tp->gesture.state == GESTURE_STATE_UNKNOWN)
tp_gesture_handle_state_unknown(tp, time, ignore_motion);
if (tp->gesture.state == GESTURE_STATE_HOLD)
tp_gesture_handle_state_hold(tp, time, ignore_motion);
if (tp->gesture.state == GESTURE_STATE_POINTER_MOTION)
tp_gesture_handle_state_pointer_motion(tp, time);
@ -1090,6 +1230,10 @@ tp_gesture_end(struct tp_dispatch *tp, uint64_t time, bool cancelled)
"%s in unknown gesture mode\n",
__func__);
break;
case GESTURE_STATE_HOLD:
gesture_notify_hold_end(&tp->device->base, time,
tp->gesture.finger_count, cancelled);
break;
case GESTURE_STATE_SCROLL:
tp_gesture_stop_twofinger_scroll(tp, time);
break;
@ -1247,10 +1391,20 @@ tp_init_gesture(struct tp_dispatch *tp)
tp_libinput_context(tp),
timer_name,
tp_gesture_finger_count_switch_timeout, tp);
snprintf(timer_name,
sizeof(timer_name),
"%s hold",
evdev_device_get_sysname(tp->device));
libinput_timer_init(&tp->gesture.hold_timer,
tp_libinput_context(tp),
timer_name,
tp_gesture_hold_timeout, tp);
}
void
tp_remove_gesture(struct tp_dispatch *tp)
{
libinput_timer_cancel(&tp->gesture.finger_count_switch_timer);
libinput_timer_cancel(&tp->gesture.hold_timer);
}

View file

@ -253,6 +253,7 @@ tp_tap_touch_handle_event(struct tp_dispatch *tp,
case TAP_EVENT_TIMEOUT:
tp->tap.state = TAP_STATE_HOLD;
tp_tap_clear_timer(tp);
tp_gesture_tap_timeout(tp, time);
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
@ -380,6 +381,7 @@ tp_tap_touch2_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_TIMEOUT:
tp->tap.state = TAP_STATE_TOUCH_2_HOLD;
tp_gesture_tap_timeout(tp, time);
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
@ -513,6 +515,7 @@ tp_tap_touch3_handle_event(struct tp_dispatch *tp,
case TAP_EVENT_TIMEOUT:
tp->tap.state = TAP_STATE_TOUCH_3_HOLD;
tp_tap_clear_timer(tp);
tp_gesture_tap_timeout(tp, time);
break;
case TAP_EVENT_RELEASE:
tp->tap.state = TAP_STATE_TOUCH_3_RELEASE;

View file

@ -2019,6 +2019,7 @@ tp_interface_destroy(struct evdev_dispatch *dispatch)
libinput_timer_destroy(&tp->dwt.keyboard_timer);
libinput_timer_destroy(&tp->tap.timer);
libinput_timer_destroy(&tp->gesture.finger_count_switch_timer);
libinput_timer_destroy(&tp->gesture.hold_timer);
free(tp->touches);
free(tp);
}

View file

@ -157,6 +157,7 @@ enum tp_edge_scroll_touch_state {
enum tp_gesture_state {
GESTURE_STATE_NONE,
GESTURE_STATE_UNKNOWN,
GESTURE_STATE_HOLD,
GESTURE_STATE_POINTER_MOTION,
GESTURE_STATE_SCROLL,
GESTURE_STATE_PINCH,
@ -359,6 +360,7 @@ struct tp_dispatch {
double prev_scale;
double angle;
struct device_float_coords center;
struct libinput_timer hold_timer;
bool hold_enabled;
} gesture;
@ -711,6 +713,9 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time,
void
tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time);
void
tp_gesture_tap_timeout(struct tp_dispatch *tp, uint64_t time);
bool
tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t);

View file

@ -286,6 +286,7 @@ START_TEST(switch_disable_touchpad)
touchpad = switch_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_grab_device(sw);
@ -325,6 +326,7 @@ START_TEST(switch_disable_touchpad_during_touch)
touchpad = switch_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
@ -438,6 +440,7 @@ START_TEST(switch_disable_touchpad_already_open)
touchpad = switch_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
/* default: switch is off - motion events */
@ -471,6 +474,7 @@ START_TEST(switch_dont_resume_disabled_touchpad)
touchpad = switch_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
libinput_device_config_send_events_set_mode(touchpad->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
litest_drain_events(li);
@ -512,6 +516,7 @@ START_TEST(switch_dont_resume_disabled_touchpad_external_mouse)
touchpad = switch_init_paired_touchpad(li);
mouse = litest_add_device(li, LITEST_MOUSE);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
libinput_device_config_send_events_set_mode(touchpad->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
litest_drain_events(li);
@ -602,6 +607,8 @@ START_TEST(lid_open_on_key_touchpad_enabled)
keyboard = litest_add_device(li, LITEST_KEYBOARD);
touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_grab_device(sw);
litest_switch_action(sw,
LIBINPUT_SWITCH_LID,
@ -928,6 +935,7 @@ START_TEST(tablet_mode_disable_touchpad_on_init)
/* touchpad comes with switch already on - no events */
touchpad = switch_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_touch_down(touchpad, 0, 50, 50);
@ -963,6 +971,7 @@ START_TEST(tablet_mode_disable_touchpad_on_resume)
touchpad = switch_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
libinput_suspend(li);
@ -1050,6 +1059,10 @@ START_TEST(tablet_mode_enable_touchpad_on_resume)
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10);
litest_touch_up(touchpad, 0);
litest_drain_events_of_type(li,
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
LIBINPUT_EVENT_GESTURE_HOLD_END,
-1);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_switch_action(sw,

View file

@ -4810,6 +4810,9 @@ START_TEST(touch_arbitration)
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
if (is_touchpad)
litest_disable_hold_gestures(finger->libinput_device);
litest_tablet_proximity_in(dev, 10, 10, axes);
litest_tablet_motion(dev, 10, 10, axes);
litest_tablet_motion(dev, 20, 40, axes);
@ -4999,6 +5002,9 @@ START_TEST(touch_arbitration_stop_touch)
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
if (is_touchpad)
litest_disable_hold_gestures(finger->libinput_device);
/* disable prox-out timer quirk */
litest_tablet_proximity_in(dev, 30, 30, axes);
litest_tablet_proximity_out(dev);
@ -5084,6 +5090,9 @@ START_TEST(touch_arbitration_suspend_touch_device)
is_touchpad = !libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
if (is_touchpad)
litest_disable_hold_gestures(dev->libinput_device);
/* we can't force a device suspend, but we can at least make sure
the device doesn't send events */
status = libinput_device_config_send_events_set_mode(
@ -5197,6 +5206,9 @@ START_TEST(touch_arbitration_remove_tablet)
is_touchpad = !libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
if (is_touchpad)
litest_disable_hold_gestures(dev->libinput_device);
libinput_dispatch(li);
litest_tablet_proximity_in(tablet, 10, 10, axes);
litest_tablet_motion(tablet, 10, 10, axes);
@ -5290,8 +5302,11 @@ START_TEST(touch_arbitration_late_touch_lift)
finger = litest_add_device(li, other);
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
if (is_touchpad)
if (is_touchpad) {
litest_enable_tap(finger->libinput_device);
litest_disable_hold_gestures(finger->libinput_device);
}
litest_tablet_proximity_in(tablet, 10, 10, axes);
litest_tablet_motion(tablet, 10, 10, axes);
litest_tablet_motion(tablet, 20, 40, axes);
@ -5739,6 +5754,7 @@ START_TEST(tablet_rotation_left_handed_add_touchpad)
libinput_device_config_left_handed_set(finger->libinput_device,
touch_from);
litest_disable_hold_gestures(finger->libinput_device);
verify_left_handed_touch_sequence(finger, li, enabled_from);
verify_left_handed_tablet_sequence(tablet, li, enabled_from);
@ -5786,6 +5802,7 @@ START_TEST(tablet_rotation_left_handed_add_tablet)
/* change left-handed before tablet appears */
libinput_device_config_left_handed_set(finger->libinput_device,
touch_from);
litest_disable_hold_gestures(finger->libinput_device);
tablet = litest_add_device(li, other);
litest_drain_events(li);

View file

@ -38,7 +38,7 @@ START_TEST(touchpad_1fg_tap)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -74,6 +74,7 @@ START_TEST(touchpad_doubletap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -213,6 +214,7 @@ START_TEST(touchpad_multitap)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -302,6 +304,7 @@ START_TEST(touchpad_multitap_n_drag_move)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -413,6 +416,7 @@ START_TEST(touchpad_multitap_n_drag_2fg)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -526,6 +530,7 @@ START_TEST(touchpad_multitap_n_drag_click)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -626,6 +631,7 @@ START_TEST(touchpad_multitap_timeout)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -715,6 +721,7 @@ START_TEST(touchpad_multitap_n_drag_timeout)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -825,6 +832,7 @@ START_TEST(touchpad_multitap_n_drag_high_delay)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -920,6 +928,7 @@ START_TEST(touchpad_multitap_n_drag_tap)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1034,6 +1043,7 @@ START_TEST(touchpad_multitap_n_drag_tap_click)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1155,6 +1165,7 @@ START_TEST(touchpad_tap_n_drag)
litest_enable_tap(dev->libinput_device);
litest_disable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1236,6 +1247,7 @@ START_TEST(touchpad_tap_n_drag_draglock)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1320,6 +1332,7 @@ START_TEST(touchpad_tap_n_drag_draglock_tap)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1422,6 +1435,7 @@ START_TEST(touchpad_tap_n_drag_draglock_tap_click)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1506,6 +1520,7 @@ START_TEST(touchpad_tap_n_drag_draglock_timeout)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1584,6 +1599,7 @@ START_TEST(touchpad_tap_n_drag_2fg)
litest_enable_tap(dev->libinput_device);
litest_disable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1662,6 +1678,7 @@ START_TEST(touchpad_tap_n_drag_2fg_scroll)
litest_enable_2fg_scroll(dev);
litest_enable_tap(dev->libinput_device);
litest_disable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1741,6 +1758,7 @@ START_TEST(touchpad_tap_n_drag_draglock_2fg_scroll)
litest_enable_2fg_scroll(dev);
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1824,6 +1842,7 @@ START_TEST(touchpad_tap_n_drag_3fg_btntool)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -1921,6 +1940,7 @@ START_TEST(touchpad_tap_n_drag_3fg)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -2006,6 +2026,7 @@ START_TEST(touchpad_tap_n_drag_3fg_swipe)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -2097,6 +2118,7 @@ START_TEST(touchpad_tap_n_drag_draglock_3fg_swipe)
litest_enable_tap(dev->libinput_device);
litest_enable_drag_lock(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -2192,6 +2214,7 @@ START_TEST(touchpad_2fg_tap)
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
litest_disable_hold_gestures(dev->libinput_device);
switch (map) {
case LIBINPUT_CONFIG_TAP_MAP_LRM:
@ -2246,6 +2269,7 @@ START_TEST(touchpad_2fg_tap_inverted)
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
litest_disable_hold_gestures(dev->libinput_device);
switch (map) {
case LIBINPUT_CONFIG_TAP_MAP_LRM:
@ -2294,6 +2318,7 @@ START_TEST(touchpad_2fg_tap_move_on_release)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
litest_touch_down(dev, 0, 50, 50);
@ -2325,7 +2350,7 @@ START_TEST(touchpad_2fg_tap_n_hold_first)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
litest_touch_down(dev, 0, 50, 50);
@ -2347,7 +2372,7 @@ START_TEST(touchpad_2fg_tap_n_hold_second)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
litest_touch_down(dev, 0, 50, 50);
@ -2369,7 +2394,7 @@ START_TEST(touchpad_2fg_tap_quickrelease)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
litest_touch_down(dev, 0, 50, 50);
@ -2400,7 +2425,7 @@ START_TEST(touchpad_1fg_tap_click)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* Finger down, finger up -> tap button press
@ -2432,7 +2457,7 @@ START_TEST(touchpad_2fg_tap_click)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* two fingers down, left button click, fingers up
@ -2467,7 +2492,7 @@ START_TEST(clickpad_2fg_tap_click)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* two fingers down, button click, fingers up
@ -2498,7 +2523,7 @@ START_TEST(touchpad_2fg_tap_click_apple)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* two fingers down, button click, fingers up
@ -2530,6 +2555,7 @@ START_TEST(touchpad_no_2fg_tap_after_move)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* one finger down, move past threshold,
@ -2553,6 +2579,7 @@ START_TEST(touchpad_no_2fg_tap_after_timeout)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* one finger down, wait past tap timeout,
@ -2579,7 +2606,7 @@ START_TEST(touchpad_no_first_fg_tap_after_move)
struct libinput_event *event;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* one finger down, second finger down,
@ -2615,6 +2642,7 @@ START_TEST(touchpad_double_tap_click)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -2690,6 +2718,7 @@ START_TEST(touchpad_tap_n_drag_click)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -2773,6 +2802,7 @@ START_TEST(touchpad_3fg_tap)
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
litest_disable_hold_gestures(dev->libinput_device);
switch (map) {
case LIBINPUT_CONFIG_TAP_MAP_LRM:
@ -2836,6 +2866,7 @@ START_TEST(touchpad_3fg_tap_tap_again)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
uint64_t ptime, rtime;
struct libinput_event *ev;
@ -2889,7 +2920,7 @@ START_TEST(touchpad_3fg_tap_quickrelease)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -2936,7 +2967,7 @@ START_TEST(touchpad_3fg_tap_pressure_btntool)
litest_enable_tap(dev->libinput_device);
litest_enable_edge_scroll(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -3001,7 +3032,7 @@ START_TEST(touchpad_3fg_tap_hover_btntool)
litest_enable_tap(dev->libinput_device);
litest_enable_edge_scroll(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -3044,6 +3075,7 @@ START_TEST(touchpad_3fg_tap_btntool)
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
litest_disable_hold_gestures(dev->libinput_device);
switch (map) {
case LIBINPUT_CONFIG_TAP_MAP_LRM:
@ -3094,6 +3126,7 @@ START_TEST(touchpad_3fg_tap_btntool_inverted)
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
litest_disable_hold_gestures(dev->libinput_device);
switch (map) {
case LIBINPUT_CONFIG_TAP_MAP_LRM:
@ -3144,6 +3177,7 @@ START_TEST(touchpad_3fg_tap_btntool_pointerjump)
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device, map);
litest_disable_hold_gestures(dev->libinput_device);
switch (map) {
case LIBINPUT_CONFIG_TAP_MAP_LRM:
@ -3195,6 +3229,7 @@ START_TEST(touchpad_3fg_tap_slot_release_btntool)
*/
litest_drain_events(li);
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
/* touch 1 down */
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
@ -3286,6 +3321,7 @@ START_TEST(touchpad_3fg_tap_after_scroll)
litest_enable_2fg_scroll(dev);
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_touch_down(dev, 0, 40, 20);
litest_touch_down(dev, 1, 50, 20);
@ -3321,6 +3357,7 @@ START_TEST(touchpad_4fg_tap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
for (i = 0; i < 4; i++) {
litest_drain_events(li);
@ -3352,7 +3389,7 @@ START_TEST(touchpad_4fg_tap_quickrelease)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -3389,6 +3426,7 @@ START_TEST(touchpad_move_after_touch)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* respective number of fingers down */
@ -3459,6 +3497,7 @@ START_TEST(touchpad_5fg_tap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
for (i = 0; i < 5; i++) {
litest_drain_events(li);
@ -3492,7 +3531,7 @@ START_TEST(touchpad_5fg_tap_quickrelease)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 20, 50);
@ -3528,7 +3567,7 @@ START_TEST(clickpad_1fg_tap_click)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
/* finger down, button click, finger up
@ -3724,6 +3763,7 @@ START_TEST(touchpad_tap_map_delayed)
litest_enable_tap(dev->libinput_device);
litest_set_tap_map(dev->libinput_device,
LIBINPUT_CONFIG_TAP_MAP_LRM);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(dev->libinput);
litest_touch_down(dev, 0, 50, 50);
@ -3811,6 +3851,8 @@ START_TEST(touchpad_drag_config_enabledisable)
struct litest_device *dev = litest_current_device();
enum libinput_config_drag_state state;
litest_disable_hold_gestures(dev->libinput_device);
litest_enable_tap(dev->libinput_device);
litest_disable_tap_drag(dev->libinput_device);
@ -3846,6 +3888,7 @@ START_TEST(touchpad_drag_disabled)
litest_enable_tap(dev->libinput_device);
litest_disable_tap_drag(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -3920,6 +3963,7 @@ START_TEST(touchpad_drag_disabled_immediate)
litest_enable_tap(dev->libinput_device);
litest_disable_tap_drag(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -3999,6 +4043,7 @@ START_TEST(touchpad_drag_disabled_multitap_no_drag)
litest_enable_tap(dev->libinput_device);
litest_disable_tap_drag(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -4156,6 +4201,7 @@ START_TEST(touchpad_tap_palm_on_idle)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* Finger down is immediately palm */
@ -4182,6 +4228,7 @@ START_TEST(touchpad_tap_palm_on_touch)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* Finger down is palm after touch begin */
@ -4209,6 +4256,7 @@ START_TEST(touchpad_tap_palm_on_touch_hold_timeout)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* Finger down is palm after tap timeout */
@ -4239,6 +4287,7 @@ START_TEST(touchpad_tap_palm_on_touch_hold_move)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* Finger down is palm after tap move threshold */
@ -4274,6 +4323,7 @@ START_TEST(touchpad_tap_palm_on_tapped)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -4355,6 +4405,7 @@ START_TEST(touchpad_tap_palm_on_tapped_palm_down)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -4441,6 +4492,7 @@ START_TEST(touchpad_tap_palm_on_tapped_doubletap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -4566,6 +4618,7 @@ START_TEST(touchpad_tap_palm_on_drag)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -4650,6 +4703,7 @@ START_TEST(touchpad_tap_palm_on_drag_2fg)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -4737,6 +4791,7 @@ START_TEST(touchpad_tap_palm_on_touch_2)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* 2fg tap with one finger detected as palm */
@ -4777,6 +4832,7 @@ START_TEST(touchpad_tap_palm_on_touch_2_retouch)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* 2fg tap with one finger detected as palm, that finger is lifted
@ -4823,6 +4879,7 @@ START_TEST(touchpad_tap_palm_on_touch_3)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* 3fg tap with one finger detected as palm, that finger is lifted,
@ -4869,6 +4926,7 @@ START_TEST(touchpad_tap_palm_on_touch_3_retouch)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* 3fg tap with one finger detected as palm, that finger is lifted,
@ -4920,6 +4978,7 @@ START_TEST(touchpad_tap_palm_on_touch_4)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* 3fg tap with one finger detected as palm, that finger is lifted,
@ -4959,6 +5018,7 @@ START_TEST(touchpad_tap_palm_after_tap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -5039,6 +5099,7 @@ START_TEST(touchpad_tap_palm_multitap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -5124,6 +5185,7 @@ START_TEST(touchpad_tap_palm_multitap_timeout)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -5208,6 +5270,7 @@ START_TEST(touchpad_tap_palm_multitap_down_again)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -5323,6 +5386,7 @@ START_TEST(touchpad_tap_palm_multitap_click)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
switch (nfingers) {
case 1:
@ -5411,6 +5475,7 @@ START_TEST(touchpad_tap_palm_click_then_tap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down_extended(dev, 0, 50, 50, axes);
@ -5463,6 +5528,7 @@ START_TEST(touchpad_tap_palm_dwt_tap)
keyboard = litest_add_device(li, LITEST_KEYBOARD);
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -5501,6 +5567,7 @@ START_TEST(touchpad_tap_palm_3fg_start)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_push_event_frame(dev);

View file

@ -60,7 +60,7 @@ START_TEST(touchpad_1fg_motion)
struct libinput_event *event;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -145,6 +145,7 @@ START_TEST(touchpad_2fg_scroll)
return;
litest_enable_2fg_scroll(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
test_2fg_scroll(dev, 0.1, 40, false);
@ -390,6 +391,7 @@ START_TEST(touchpad_2fg_scroll_slow_distance)
y_move = 100.0/height * 7;
litest_enable_2fg_scroll(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 49, 50);
@ -1178,7 +1180,7 @@ START_TEST(touchpad_palm_detect_at_edge)
litest_enable_2fg_scroll(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 99, 50);
@ -1204,7 +1206,7 @@ START_TEST(touchpad_palm_detect_at_top)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 20, 1);
@ -1247,6 +1249,7 @@ START_TEST(touchpad_palm_detect_at_bottom_corners)
litest_enable_2fg_scroll(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
/* Run for non-clickpads only: make sure the bottom corners trigger
palm detection too */
@ -1276,6 +1279,7 @@ START_TEST(touchpad_palm_detect_at_top_corners)
litest_enable_2fg_scroll(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
/* Run for non-clickpads only: make sure the bottom corners trigger
palm detection too */
@ -1307,7 +1311,7 @@ START_TEST(touchpad_palm_detect_palm_stays_palm)
litest_enable_2fg_scroll(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 99, 20);
@ -1326,7 +1330,7 @@ START_TEST(touchpad_palm_detect_top_palm_stays_palm)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 20, 1);
@ -1349,7 +1353,7 @@ START_TEST(touchpad_palm_detect_palm_becomes_pointer)
litest_enable_2fg_scroll(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 99, 50);
@ -1373,7 +1377,7 @@ START_TEST(touchpad_palm_detect_top_palm_becomes_pointer)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 1);
@ -1397,6 +1401,7 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_edges)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
/* moving non-palm into the edge does not label it as palm */
litest_drain_events(li);
@ -1426,6 +1431,7 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_top)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
/* moving non-palm into the edge does not label it as palm */
litest_drain_events(li);
@ -1455,7 +1461,7 @@ START_TEST(touchpad_palm_detect_no_tap_top_edge)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 1);
@ -1476,7 +1482,7 @@ START_TEST(touchpad_palm_detect_tap_hardbuttons)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 95, 5);
@ -1519,7 +1525,7 @@ START_TEST(touchpad_palm_detect_tap_softbuttons)
litest_enable_tap(dev->libinput_device);
litest_enable_buttonareas(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 99, 99);
@ -1574,7 +1580,7 @@ START_TEST(touchpad_palm_detect_tap_clickfinger)
litest_enable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 95, 5);
@ -1727,6 +1733,7 @@ START_TEST(touchpad_palm_detect_tool_palm_tap_after)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_push_event_frame(dev);
@ -1769,6 +1776,7 @@ START_TEST(touchpad_palm_detect_tool_palm_tap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_push_event_frame(dev);
@ -1814,6 +1822,7 @@ START_TEST(touchpad_palm_detect_pressure)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down_extended(dev, 0, 50, 99, axes);
@ -1838,6 +1847,7 @@ START_TEST(touchpad_palm_detect_pressure_late_tap)
litest_enable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* event after touch down is palm */
@ -1871,6 +1881,7 @@ START_TEST(touchpad_palm_detect_pressure_tap_hold)
litest_enable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* event in state HOLD is thumb */
@ -1905,6 +1916,7 @@ START_TEST(touchpad_palm_detect_pressure_tap_hold_2ndfg)
litest_enable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* event in state HOLD is thumb */
@ -1952,6 +1964,7 @@ START_TEST(touchpad_palm_detect_move_and_tap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* trigger thumb detection by pressure after a slight movement */
@ -1991,6 +2004,7 @@ START_TEST(touchpad_palm_detect_pressure_late)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -2017,6 +2031,7 @@ START_TEST(touchpad_palm_detect_pressure_keep_palm)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 80, 90);
@ -2044,6 +2059,7 @@ START_TEST(touchpad_palm_detect_pressure_after_edge)
litest_enable_2fg_scroll(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 99, 50);
@ -2070,6 +2086,7 @@ START_TEST(touchpad_palm_detect_pressure_after_dwt)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -2109,6 +2126,7 @@ START_TEST(touchpad_palm_clickfinger_pressure)
litest_enable_clickfinger(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down_extended(dev, 0, 50, 95, axes);
@ -2142,6 +2160,7 @@ START_TEST(touchpad_palm_clickfinger_pressure_2fg)
litest_enable_clickfinger(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down_extended(dev, 0, 50, 95, axes);
@ -2191,6 +2210,7 @@ START_TEST(touchpad_palm_clickfinger_size)
litest_enable_clickfinger(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down_extended(dev, 0, 50, 95, axes);
@ -2226,6 +2246,7 @@ START_TEST(touchpad_palm_clickfinger_size_2fg)
litest_enable_clickfinger(dev);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down_extended(dev, 0, 50, 95, axes);
@ -2415,6 +2436,7 @@ START_TEST(touchpad_left_handed_tapping)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
@ -2449,6 +2471,7 @@ START_TEST(touchpad_left_handed_tapping_2fg)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
status = libinput_device_config_left_handed_set(d, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
@ -3207,7 +3230,7 @@ START_TEST(touchpad_hover_1fg_tap)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_hover_start(dev, 0, 50, 50);
@ -3504,6 +3527,7 @@ START_TEST(touchpad_initial_state)
libinput1 = dev->libinput;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_touch_down(dev, 0, x, y);
litest_touch_up(dev, 0);
@ -3634,6 +3658,7 @@ START_TEST(touchpad_state_after_syn_dropped_2fg_change)
litest_drain_events(li);
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_touch_down(dev, 0, 10, 10);
libinput_dispatch(li);
@ -3681,6 +3706,7 @@ START_TEST(touchpad_dwt)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -3716,6 +3742,7 @@ START_TEST(touchpad_dwt_ext_and_int_keyboard)
return;
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
/* Yubikey is initialized first */
yubikey = litest_add_device(li, LITEST_YUBIKEY);
@ -3759,6 +3786,7 @@ START_TEST(touchpad_dwt_enable_touch)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -3797,6 +3825,7 @@ START_TEST(touchpad_dwt_touch_hold)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -3834,6 +3863,7 @@ START_TEST(touchpad_dwt_key_hold)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -3861,6 +3891,7 @@ START_TEST(touchpad_dwt_key_hold_timeout)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -3910,6 +3941,7 @@ START_TEST(touchpad_dwt_key_hold_timeout_existing_touch_cornercase)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -3960,6 +3992,7 @@ START_TEST(touchpad_dwt_key_hold_timeout_existing_touch)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4001,6 +4034,7 @@ START_TEST(touchpad_dwt_type)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
for (i = 0; i < 5; i++) {
@ -4039,6 +4073,7 @@ START_TEST(touchpad_dwt_type_short_timeout)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
for (i = 0; i < 5; i++) {
@ -4091,6 +4126,7 @@ START_TEST(touchpad_dwt_modifier_no_dwt)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
ARRAY_FOR_EACH(modifiers, key) {
@ -4136,6 +4172,7 @@ START_TEST(touchpad_dwt_modifier_combo_no_dwt)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
ARRAY_FOR_EACH(modifiers, key) {
@ -4185,6 +4222,7 @@ START_TEST(touchpad_dwt_modifier_combo_dwt_after)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
ARRAY_FOR_EACH(modifiers, key) {
@ -4238,6 +4276,7 @@ START_TEST(touchpad_dwt_modifier_combo_dwt_remains)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
ARRAY_FOR_EACH(modifiers, key) {
@ -4285,6 +4324,7 @@ START_TEST(touchpad_dwt_fkeys_no_dwt)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
for (key = KEY_F1; key < KEY_CNT; key++) {
@ -4319,6 +4359,7 @@ START_TEST(touchpad_dwt_tap)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_enable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4349,6 +4390,7 @@ START_TEST(touchpad_dwt_tap_drag)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_enable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4383,6 +4425,7 @@ START_TEST(touchpad_dwt_click)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4587,6 +4630,7 @@ START_TEST(touchpad_dwt_disabled)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4616,6 +4660,7 @@ START_TEST(touchpad_dwt_disable_during_touch)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4658,6 +4703,7 @@ START_TEST(touchpad_dwt_disable_before_touch)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4689,6 +4735,7 @@ START_TEST(touchpad_dwt_disable_during_key_release)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4723,6 +4770,7 @@ START_TEST(touchpad_dwt_disable_during_key_hold)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4755,6 +4803,7 @@ START_TEST(touchpad_dwt_enable_during_touch)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4789,6 +4838,7 @@ START_TEST(touchpad_dwt_enable_before_touch)
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
@ -4817,6 +4867,7 @@ START_TEST(touchpad_dwt_enable_during_tap)
litest_enable_tap(touchpad->libinput_device);
disable_dwt(touchpad);
litest_disable_hold_gestures(touchpad->libinput_device);
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_drain_events(li);
@ -4855,6 +4906,7 @@ START_TEST(touchpad_dwt_remove_kbd_while_active)
litest_enable_tap(touchpad->libinput_device);
enable_dwt(touchpad);
litest_disable_hold_gestures(touchpad->libinput_device);
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_drain_events(li);
@ -5115,7 +5167,7 @@ START_TEST(touchpad_thumb_lower_area_movement)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* Thumb below lower line - slow movement - no events */
@ -5140,7 +5192,7 @@ START_TEST(touchpad_thumb_lower_area_movement_rethumb)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* Thumb below lower line - fast movement - events */
@ -5163,6 +5215,7 @@ START_TEST(touchpad_thumb_speed_empty_slots)
litest_disable_tap(dev->libinput_device);
litest_enable_2fg_scroll(dev);
litest_disable_hold_gestures(dev->libinput_device);
if (libevdev_get_num_slots(dev->evdev) < 3)
return;
@ -5205,6 +5258,7 @@ START_TEST(touchpad_thumb_area_clickfinger)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
libinput_device_config_click_set_method(dev->libinput_device,
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
@ -5259,6 +5313,7 @@ START_TEST(touchpad_thumb_area_btnarea)
return;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
libinput_device_config_click_set_method(dev->libinput_device,
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
@ -5289,6 +5344,7 @@ START_TEST(touchpad_thumb_no_doublethumb)
litest_disable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
litest_disable_hold_gestures(dev->libinput_device);
if (!has_thumb_detect(dev))
return;
@ -5630,7 +5686,7 @@ START_TEST(touchpad_time_usec)
struct libinput_event *event;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
@ -6046,6 +6102,7 @@ START_TEST(touchpad_pressure_tap)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down_extended(dev, 0, 50, 50, axes);
@ -6069,6 +6126,7 @@ START_TEST(touchpad_pressure_tap_2fg)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* tap but too light */
@ -6096,6 +6154,7 @@ START_TEST(touchpad_pressure_tap_2fg_1fg_light)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* double-tap with one finger too light */
@ -6142,6 +6201,7 @@ START_TEST(touchpad_pressure_btntool)
return;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
/* Two light touches down, doesn't count */
@ -6664,6 +6724,7 @@ START_TEST(touchpad_suspend_abba)
litest_grab_device(tabletmode);
litest_disable_tap(tp->libinput_device);
litest_disable_hold_gestures(tp->libinput_device);
/* ABBA test for touchpad internal suspend:
* reason A on
@ -6802,6 +6863,7 @@ START_TEST(touchpad_suspend_abab)
litest_grab_device(tabletmode);
litest_disable_tap(tp->libinput_device);
litest_disable_hold_gestures(tp->libinput_device);
/* ABAB test for touchpad internal suspend:
* reason A on
@ -6945,7 +7007,7 @@ START_TEST(touchpad_end_start_touch)
struct libinput *li = dev->libinput;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);

View file

@ -164,6 +164,8 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint)
struct libinput_event *event;
struct libinput_device *device;
litest_disable_hold_gestures(touchpad->libinput_device);
trackpoint = litest_add_device(li, LITEST_TRACKPOINT);
litest_drain_events(li);
/* touchpad right-handed, trackpoint left-handed */
@ -207,6 +209,8 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad)
struct libinput_event *event;
struct libinput_device *device;
litest_disable_hold_gestures(touchpad->libinput_device);
trackpoint = litest_add_device(li, LITEST_TRACKPOINT);
litest_drain_events(li);
/* touchpad left-handed, trackpoint right-handed */
@ -248,6 +252,8 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
struct libinput_event *event;
struct libinput_device *device;
litest_disable_hold_gestures(touchpad->libinput_device);
trackpoint = litest_add_device(li, LITEST_TRACKPOINT);
litest_drain_events(li);
/* touchpad left-handed, trackpoint left-handed */
@ -293,6 +299,7 @@ START_TEST(trackpoint_palmdetect)
int i;
touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
for (i = 0; i < 10; i++) {
@ -328,6 +335,7 @@ START_TEST(trackpoint_palmdetect_resume_touch)
int i;
touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
for (i = 0; i < 10; i++) {
@ -361,6 +369,7 @@ START_TEST(trackpoint_palmdetect_require_min_events)
struct libinput *li = trackpoint->libinput;
touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
/* A single event does not trigger palm detection */
@ -386,6 +395,7 @@ START_TEST(trackpoint_palmdetect_require_min_events_timeout)
struct libinput *li = trackpoint->libinput;
touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
litest_disable_hold_gestures(touchpad->libinput_device);
litest_drain_events(li);
for (int i = 0; i < 10; i++) {