From 4ccdacaf95a62e7895eb150aec6b93cd8c69f842 Mon Sep 17 00:00:00 2001 From: satrmb <10471-satrmb_true-email-is-private_contact-via-web@gitlab.freedesktop.org> Date: Fri, 12 Feb 2021 12:09:07 +0100 Subject: [PATCH] touchpad: permit only one finger on the touchpad at the start of a tap-drag This only affects the actual dragging part of the tap-and-drag interaction; n-finger tap-and-drag is supposed to be performed with a n-finger tap followed by a 1-finger drag. Allowing a second finger in the middle of a drag is still necessary for a finger swap, which users may need in long-distance drags, especially when drag-lock is disabled. Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org> --- doc/touchpad-tap-state-machine.svg | 2 +- src/evdev-mt-touchpad-tap.c | 278 ++--------------------------- src/evdev-mt-touchpad.h | 12 +- test/test-touchpad-tap.c | 14 +- 4 files changed, 26 insertions(+), 280 deletions(-) diff --git a/doc/touchpad-tap-state-machine.svg b/doc/touchpad-tap-state-machine.svg index 637041a8..ea188143 100644 --- a/doc/touchpad-tap-state-machine.svg +++ b/doc/touchpad-tap-state-machine.svg @@ -1,3 +1,3 @@ -(this section exists for [n] = 1, [n] = 2, and [n] = 3)(this section exists for [n] = 1, [n] = 2, and [n] = 3)IDLETOUCHfirstfinger downfinger upbutton 1presstimeoutmove > thresholdsecondfinger downTOUCH_2secondfinger upbutton 2pressmove > thresholdtimeoutbutton 1releasebutton 2release[n]FGTAP_TAPPEDtimeoutfirstfinger down[n]FGTAP_DRAGGINGfirstfinger upbutton [n]releaseIDLEthirdfinger downTOUCH_3button 3pressbutton 3releasemove > thresholdIDLEtimeoutfirstfinger upIDLEfourthfinger down[n]FGTAP_DRAGGING_OR_DOUBLETAPtimeoutfirstfinger upbutton [n]releasesecondfinger downmove > thresholdHOLDfirstfinger upsecondfinger downTOUCH_2_HOLDsecondfinger upthirdfinger downTOUCH_3_HOLDfourthfinger downDEADany finger upfourthfinger upany finger upany finger upIDLEif fingercount == 0[n]FGTAP_DRAGGING_2secondfinger downthirdfinger downbutton [n]releasephysbuttonpressphysbuttonpressbutton [n]release[n]FGTAP_DRAGGING_WAITtimeoutfirstfinger downTOUCH_TOUCHTOUCH_IDLETOUCH_DEADTOUCH_DEADTOUCH_IDLETOUCH_TOUCHTOUCH_IDLETOUCH_IDLETOUCH_TOUCHthat fingerTOUCH_IDLETOUCH_DEADthat fingerTOUCH_IDLETOUCH_TOUCHTOUCH_IDLETOUCH_TOUCHTOUCH_DEADTOUCH_IDLETOUCH_TOUCHTOUCH_TOUCHTOUCH_TOUCHTOUCH_IDLETOUCH_TOUCHthat fingerTOUCH_IDLETOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEAD[n]FGTAP_DRAGGING_OR_END_DRAGLOCKfirstfinger uptimeoutmove > thresholdTOUCH_IDLEdrag lockenabled?nonoyesyes thumbTOUCH_DEADTOUCH_2_RELEASEsecondfinger uptimeoutmove > thresholdfirstfinger downTOUCH_IDLEfirstfinger upsecondfinger downTOUCH_DEADTOUCH_DEADdragdisabled?yesyespalmeither fingerpalmremaining fingerpalmany fingerpalmthat fingerTOUCH_DEADthat fingerTOUCH_DEADpalmany fingerpalmthat fingerTOUCH_DEADTOUCH_DEADpalmTOUCH_DEADany fingerpalmthat fingerTOUCH_DEADeither fingerpalmthat fingerTOUCH_DEADpalmTOUCH_DEADany fingerpalmthat fingerTOUCH_DEADTOUCH_DEADmove > thresholdmove > thresholdbutton 1press[n] = 1[n] = 1[n] = 1[n] = 1nonobutton [n]releaseIDLEdragdisabled?[n] = 2[n] = 2nonoyesyesdragdisabled?yesyesnono[n] = 3[n] = 3TOUCH_3_RELEASEtimeoutTOUCH_DEADTOUCH_DEADeither fingerpalmthat fingerTOUCH_DEADmove > thresholdthirdfinger downTOUCH_TOUCHTOUCH_3_RELEASE_2remainingfinger upthat fingerTOUCH_IDLEeither finger upthat fingerTOUCH_IDLEsecondfinger downremaining fingerpalmTOUCH_DEADtimeoutfirstfinger upbutton 3pressbutton 3releasebutton 3pressbutton 3release[n]FGTAP_DRAGGING_OR_END_DRAGLOCK_2either finger upthat fingerTOUCH_IDLEsecondfinger downTOUCH_TOUCHeither fingerpalmthat fingerTOUCH_DEADeither finger upthat fingerTOUCH_IDLEtimeoutmove > threshold[n]FGTAP_DRAGGING_OR_DOUBLETAP_2either fingerpalmthat fingerTOUCH_DEADtimeoutmove > thresholdthirdfinger downTOUCH_TOUCHbutton [n]release[n]FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASEeither finger upthat fingerTOUCH_IDLEtimeoutmove > thresholdsecondfinger downTOUCH_DEADremaining fingerpalmremainingfinger upthat fingerTOUCH_IDLEbutton [n]releasebutton 2press[n] = 2[n] = 2button 3pressbutton 3releaseTOUCH_DEADbutton 3pressbutton 3releasebutton 3pressbutton 3releaseViewer does not support full SVG 1.1 \ No newline at end of file +(this section exists for [n] = 1, [n] = 2, and [n] = 3)(this section exists for [n] = 1, [n] = 2, and [n] = 3)IDLETOUCHfirstfinger downfinger upbutton 1presstimeoutmove > thresholdsecondfinger downTOUCH_2secondfinger upbutton 2pressmove > thresholdtimeoutbutton 1releasebutton 2release[n]FGTAP_TAPPEDtimeoutfirstfinger down[n]FGTAP_DRAGGINGfirstfinger upbutton [n]releaseIDLEthirdfinger downTOUCH_3button 3pressbutton 3releasemove > thresholdIDLEtimeoutfirstfinger upIDLEfourthfinger down[n]FGTAP_DRAGGING_OR_DOUBLETAPtimeoutfirstfinger upbutton [n]releasesecondfinger downmove > thresholdHOLDfirstfinger upsecondfinger downTOUCH_2_HOLDsecondfinger upthirdfinger downTOUCH_3_HOLDfourthfinger downDEADany finger upfourthfinger upany finger upany finger upIDLEif fingercount == 0[n]FGTAP_DRAGGING_2secondfinger downthirdfinger downphysbuttonpressphysbuttonpressbutton [n]release[n]FGTAP_DRAGGING_WAITtimeoutfirstfinger downTOUCH_TOUCHTOUCH_IDLETOUCH_DEADTOUCH_DEADTOUCH_IDLETOUCH_TOUCHTOUCH_IDLETOUCH_IDLETOUCH_TOUCHthat fingerTOUCH_IDLETOUCH_DEADthat fingerTOUCH_IDLETOUCH_TOUCHTOUCH_IDLETOUCH_TOUCHTOUCH_DEADTOUCH_IDLETOUCH_TOUCHTOUCH_TOUCHTOUCH_IDLETOUCH_TOUCHthat fingerTOUCH_IDLETOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEADTOUCH_DEAD[n]FGTAP_DRAGGING_OR_TAPfirstfinger uptimeoutmove > thresholdTOUCH_IDLEdrag lockenabled?nonoyesyes thumbTOUCH_DEADTOUCH_2_RELEASEsecondfinger uptimeoutmove > thresholdfirstfinger downTOUCH_IDLEfirstfinger upsecondfinger downTOUCH_DEADTOUCH_DEADdragdisabled?yesyespalmeither fingerpalmremaining fingerpalmany fingerpalmthat fingerTOUCH_DEADthat fingerTOUCH_DEADpalmany fingerpalmthat fingerTOUCH_DEADTOUCH_DEADpalmTOUCH_DEADany fingerpalmthat fingerTOUCH_DEADeither fingerpalmthat fingerTOUCH_DEADpalmTOUCH_DEADany fingerpalmthat fingerTOUCH_DEADTOUCH_DEADmove > thresholdmove > thresholdbutton 1press[n] = 1[n] = 1[n] = 1[n] = 1nonobutton [n]releaseIDLEdragdisabled?[n] = 2[n] = 2nonoyesyesdragdisabled?yesyesnono[n] = 3[n] = 3TOUCH_3_RELEASEtimeoutTOUCH_DEADTOUCH_DEADeither fingerpalmthat fingerTOUCH_DEADmove > thresholdthirdfinger downTOUCH_TOUCHTOUCH_3_RELEASE_2remainingfinger upthat fingerTOUCH_IDLEeither finger upthat fingerTOUCH_IDLEsecondfinger downremaining fingerpalmTOUCH_DEADtimeoutfirstfinger upbutton 3pressbutton 3releasebutton 3pressbutton 3releaseeither finger upthat fingerTOUCH_IDLEsecondfinger downbutton [n]releasebutton 3pressbutton 3releaseTOUCH_DEADbutton 3pressbutton 3releasebutton 3pressbutton 3releaseViewer does not support full SVG 1.1 \ No newline at end of file diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index b077681e..fb8ca219 100644 --- a/src/evdev-mt-touchpad-tap.c +++ b/src/evdev-mt-touchpad-tap.c @@ -81,18 +81,9 @@ tap_state_to_str(enum tp_tap_state state) CASE_RETURN_STRING(TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP); CASE_RETURN_STRING(TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP); CASE_RETURN_STRING(TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP); - CASE_RETURN_STRING(TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2); - CASE_RETURN_STRING(TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2); - CASE_RETURN_STRING(TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2); - CASE_RETURN_STRING(TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE); - CASE_RETURN_STRING(TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE); - CASE_RETURN_STRING(TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE); CASE_RETURN_STRING(TAP_STATE_1FGTAP_DRAGGING_OR_TAP); CASE_RETURN_STRING(TAP_STATE_2FGTAP_DRAGGING_OR_TAP); CASE_RETURN_STRING(TAP_STATE_3FGTAP_DRAGGING_OR_TAP); - CASE_RETURN_STRING(TAP_STATE_1FGTAP_DRAGGING_OR_TAP_2); - CASE_RETURN_STRING(TAP_STATE_2FGTAP_DRAGGING_OR_TAP_2); - CASE_RETURN_STRING(TAP_STATE_3FGTAP_DRAGGING_OR_TAP_2); CASE_RETURN_STRING(TAP_STATE_1FGTAP_DRAGGING_2); CASE_RETURN_STRING(TAP_STATE_2FGTAP_DRAGGING_2); CASE_RETURN_STRING(TAP_STATE_3FGTAP_DRAGGING_2); @@ -745,13 +736,11 @@ tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp, { switch (event) { case TAP_EVENT_TOUCH: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2, - TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2, - TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; + tp_tap_notify(tp, + tp->tap.saved_release_time, + nfingers_tapped, + LIBINPUT_BUTTON_STATE_RELEASED); + tp->tap.state = TAP_STATE_TOUCH_2; tp->tap.saved_press_time = time; tp_tap_set_timer(tp, time); break; @@ -804,139 +793,6 @@ tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp, } } -static void -tp_tap_dragging_or_doubletap_2_handle_event(struct tp_dispatch *tp, - struct tp_touch *t, - enum tap_event event, uint64_t time, - int nfingers_tapped) -{ - switch (event) { - case TAP_EVENT_TOUCH: - tp_tap_notify(tp, - tp->tap.saved_release_time, - nfingers_tapped, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.state = TAP_STATE_TOUCH_3; - tp->tap.saved_press_time = time; - tp_tap_set_timer(tp, time); - break; - case TAP_EVENT_RELEASE: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE, - TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE, - TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - /* We are overwriting saved_release_time, but if this is indeed - a multitap with two fingers, then we will need its previous - value for the click release event we withheld just in case - this is still a drag. */ - tp->tap.saved_multitap_release_time = tp->tap.saved_release_time; - tp->tap.saved_release_time = time; - tp_tap_set_timer(tp, time); - break; - } - case TAP_EVENT_MOTION: - case TAP_EVENT_TIMEOUT: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_2, - TAP_STATE_2FGTAP_DRAGGING_2, - TAP_STATE_3FGTAP_DRAGGING_2, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - break; - } - case TAP_EVENT_BUTTON: - tp->tap.state = TAP_STATE_DEAD; - tp_tap_notify(tp, - tp->tap.saved_release_time, - nfingers_tapped, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - case TAP_EVENT_THUMB: - break; - case TAP_EVENT_PALM: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP, - TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP, - TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - break; - } - case TAP_EVENT_PALM_UP: - break; - } -} - -static void -tp_tap_dragging_or_doubletap_2_release_handle_event(struct tp_dispatch *tp, - struct tp_touch *t, - enum tap_event event, - uint64_t time, - int nfingers_tapped) -{ - switch (event) { - case TAP_EVENT_TOUCH: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_2, - TAP_STATE_2FGTAP_DRAGGING_2, - TAP_STATE_3FGTAP_DRAGGING_2, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - break; - } - case TAP_EVENT_RELEASE: - tp->tap.state = TAP_STATE_2FGTAP_TAPPED; - tp_tap_notify(tp, - tp->tap.saved_multitap_release_time, - nfingers_tapped, - LIBINPUT_BUTTON_STATE_RELEASED); - tp_tap_notify(tp, - tp->tap.saved_press_time, - 2, - LIBINPUT_BUTTON_STATE_PRESSED); - tp_tap_set_timer(tp, time); - break; - case TAP_EVENT_MOTION: - case TAP_EVENT_TIMEOUT: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING, - TAP_STATE_2FGTAP_DRAGGING, - TAP_STATE_3FGTAP_DRAGGING, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - break; - } - case TAP_EVENT_BUTTON: - tp->tap.state = TAP_STATE_DEAD; - tp_tap_notify(tp, - tp->tap.saved_release_time, - nfingers_tapped, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - case TAP_EVENT_THUMB: - break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_1FGTAP_TAPPED; - tp_tap_notify(tp, - tp->tap.saved_release_time, - nfingers_tapped, - LIBINPUT_BUTTON_STATE_RELEASED); - tp_tap_notify(tp, - tp->tap.saved_press_time, - 1, - LIBINPUT_BUTTON_STATE_PRESSED); - case TAP_EVENT_PALM_UP: - break; - } -} - static void tp_tap_dragging_handle_event(struct tp_dispatch *tp, struct tp_touch *t, @@ -1053,14 +909,12 @@ tp_tap_dragging_tap_handle_event(struct tp_dispatch *tp, switch (event) { case TAP_EVENT_TOUCH: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_OR_TAP_2, - TAP_STATE_2FGTAP_DRAGGING_OR_TAP_2, - TAP_STATE_3FGTAP_DRAGGING_OR_TAP_2, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - tp_tap_set_timer(tp, time); + tp_tap_notify(tp, + time, + nfingers_tapped, + LIBINPUT_BUTTON_STATE_RELEASED); + tp_tap_clear_timer(tp); + tp_tap_move_to_dead(tp, t); break; } case TAP_EVENT_RELEASE: @@ -1105,68 +959,6 @@ tp_tap_dragging_tap_handle_event(struct tp_dispatch *tp, } } -static void -tp_tap_dragging_tap_2_handle_event(struct tp_dispatch *tp, - struct tp_touch *t, - enum tap_event event, uint64_t time, - int nfingers_tapped) -{ - - switch (event) { - case TAP_EVENT_TOUCH: - tp_tap_notify(tp, - time, - nfingers_tapped, - LIBINPUT_BUTTON_STATE_RELEASED); - tp_tap_clear_timer(tp); - tp_tap_move_to_dead(tp, t); - break; - case TAP_EVENT_RELEASE: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_OR_TAP, - TAP_STATE_2FGTAP_DRAGGING_OR_TAP, - TAP_STATE_3FGTAP_DRAGGING_OR_TAP, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - tp_tap_set_timer(tp, time); - break; - } - case TAP_EVENT_MOTION: - case TAP_EVENT_TIMEOUT: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_2, - TAP_STATE_2FGTAP_DRAGGING_2, - TAP_STATE_3FGTAP_DRAGGING_2, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - break; - } - case TAP_EVENT_BUTTON: - tp->tap.state = TAP_STATE_DEAD; - tp_tap_notify(tp, - time, - nfingers_tapped, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - case TAP_EVENT_THUMB: - break; - case TAP_EVENT_PALM: { - enum tp_tap_state dest[3] = { - TAP_STATE_1FGTAP_DRAGGING_OR_TAP, - TAP_STATE_2FGTAP_DRAGGING_OR_TAP, - TAP_STATE_3FGTAP_DRAGGING_OR_TAP, - }; - assert(nfingers_tapped >= 1 && nfingers_tapped <= 3); - tp->tap.state = dest[nfingers_tapped - 1]; - break; - } - case TAP_EVENT_PALM_UP: - break; - } -} - static void tp_tap_dragging2_handle_event(struct tp_dispatch *tp, struct tp_touch *t, @@ -1309,33 +1101,6 @@ tp_tap_handle_event(struct tp_dispatch *tp, tp_tap_dragging_or_doubletap_handle_event(tp, t, event, time, 3); break; - case TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2: - tp_tap_dragging_or_doubletap_2_handle_event(tp, t, event, time, - 1); - break; - case TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2: - tp_tap_dragging_or_doubletap_2_handle_event(tp, t, event, time, - 2); - break; - case TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2: - tp_tap_dragging_or_doubletap_2_handle_event(tp, t, event, time, - 3); - break; - case TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE: - tp_tap_dragging_or_doubletap_2_release_handle_event(tp, t, - event, time, - 1); - break; - case TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE: - tp_tap_dragging_or_doubletap_2_release_handle_event(tp, t, - event, time, - 2); - break; - case TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE: - tp_tap_dragging_or_doubletap_2_release_handle_event(tp, t, - event, time, - 3); - break; case TAP_STATE_1FGTAP_DRAGGING: tp_tap_dragging_handle_event(tp, t, event, time, 1); break; @@ -1363,15 +1128,6 @@ tp_tap_handle_event(struct tp_dispatch *tp, case TAP_STATE_3FGTAP_DRAGGING_OR_TAP: tp_tap_dragging_tap_handle_event(tp, t, event, time, 3); break; - case TAP_STATE_1FGTAP_DRAGGING_OR_TAP_2: - tp_tap_dragging_tap_2_handle_event(tp, t, event, time, 1); - break; - case TAP_STATE_2FGTAP_DRAGGING_OR_TAP_2: - tp_tap_dragging_tap_2_handle_event(tp, t, event, time, 2); - break; - case TAP_STATE_3FGTAP_DRAGGING_OR_TAP_2: - tp_tap_dragging_tap_2_handle_event(tp, t, event, time, 3); - break; case TAP_STATE_1FGTAP_DRAGGING_2: tp_tap_dragging2_handle_event(tp, t, event, time, 1); break; @@ -1549,18 +1305,9 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time) case TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP: case TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP: case TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP: - case TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2: - case TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2: - case TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2: - case TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE: - case TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE: - case TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE: case TAP_STATE_1FGTAP_DRAGGING_OR_TAP: case TAP_STATE_2FGTAP_DRAGGING_OR_TAP: case TAP_STATE_3FGTAP_DRAGGING_OR_TAP: - case TAP_STATE_1FGTAP_DRAGGING_OR_TAP_2: - case TAP_STATE_2FGTAP_DRAGGING_OR_TAP_2: - case TAP_STATE_3FGTAP_DRAGGING_OR_TAP_2: case TAP_STATE_TOUCH_2: case TAP_STATE_TOUCH_3: filter_motion = 1; @@ -1901,9 +1648,6 @@ tp_tap_dragging(const struct tp_dispatch *tp) case TAP_STATE_1FGTAP_DRAGGING_OR_TAP: case TAP_STATE_2FGTAP_DRAGGING_OR_TAP: case TAP_STATE_3FGTAP_DRAGGING_OR_TAP: - case TAP_STATE_1FGTAP_DRAGGING_OR_TAP_2: - case TAP_STATE_2FGTAP_DRAGGING_OR_TAP_2: - case TAP_STATE_3FGTAP_DRAGGING_OR_TAP_2: return true; default: return false; diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 15c1e55a..6e1e1e3a 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -119,18 +119,9 @@ enum tp_tap_state { TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP, TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP, TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP, - TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2, - TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2, - TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2, - TAP_STATE_1FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE, - TAP_STATE_2FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE, - TAP_STATE_3FGTAP_DRAGGING_OR_DOUBLETAP_2_RELEASE, TAP_STATE_1FGTAP_DRAGGING_OR_TAP, TAP_STATE_2FGTAP_DRAGGING_OR_TAP, TAP_STATE_3FGTAP_DRAGGING_OR_TAP, - TAP_STATE_1FGTAP_DRAGGING_OR_TAP_2, - TAP_STATE_2FGTAP_DRAGGING_OR_TAP_2, - TAP_STATE_3FGTAP_DRAGGING_OR_TAP_2, TAP_STATE_1FGTAP_DRAGGING, TAP_STATE_2FGTAP_DRAGGING, TAP_STATE_3FGTAP_DRAGGING, @@ -430,8 +421,7 @@ struct tp_dispatch { enum tp_tap_state state; uint32_t buttons_pressed; uint64_t saved_press_time, - saved_release_time, - saved_multitap_release_time; + saved_release_time; enum libinput_config_tap_button_map map; enum libinput_config_tap_button_map want_map; diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c index 4cd5ab92..ff12ff3b 100644 --- a/test/test-touchpad-tap.c +++ b/test/test-touchpad-tap.c @@ -468,7 +468,7 @@ START_TEST(touchpad_multitap_n_drag_2fg) libinput_dispatch(li); litest_touch_down(dev, 0, 50, 50); - msleep(10); + litest_touch_move_to(dev, 0, 50, 50, 30, 50, 10); litest_touch_down(dev, 1, 70, 50); libinput_dispatch(li); @@ -1645,6 +1645,9 @@ START_TEST(touchpad_tap_n_drag_2fg) break; } litest_touch_down(dev, 0, 30, 70); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); litest_touch_down(dev, 1, 80, 70); litest_touch_move_to(dev, 0, 30, 70, 30, 30, 10); libinput_dispatch(li); @@ -1724,6 +1727,9 @@ START_TEST(touchpad_tap_n_drag_3fg_btntool) break; } litest_touch_down(dev, 0, 30, 70); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); litest_touch_down(dev, 1, 80, 90); litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5); libinput_dispatch(li); @@ -1806,6 +1812,9 @@ START_TEST(touchpad_tap_n_drag_3fg) break; } litest_touch_down(dev, 0, 30, 70); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); litest_touch_down(dev, 1, 80, 90); litest_touch_move_to(dev, 0, 30, 70, 30, 30, 10); libinput_dispatch(li); @@ -4374,6 +4383,9 @@ START_TEST(touchpad_tap_palm_on_drag_2fg) LIBINPUT_BUTTON_STATE_PRESSED); litest_touch_down(dev, this, 50, 50); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); litest_touch_down(dev, other, 60, 50); libinput_dispatch(li);