[PATCH libinput] touchpad: fix double/multitap timeouts
Peter Hutterer
peter.hutterer at who-t.net
Fri May 1 15:23:37 PDT 2015
On 2/05/2015 04:21 , Bill Spitzak wrote:
> Are you saying the first event is delayed until it knows whether it is
> double-tap or not? That is not going to work, it will introduce a huge
> annoying latency to interaction.
>
> I suspect I am misunderstanding this and an event is sent, but want to
> make sure.
There's an svg diagram showing the state machine in the doc directory.
It shows when events are sent. Short answer: the press event is sent
very early, the release event may be delayed.
And to pre-empt the next comment: feel free to come up with a better
solution that doesn't have said "annoying latency" but still allows for
tap-and-drag. If you do, please let us know in (pseudo)code rather than
general comments.
Cheers,
Peter
>
> On 04/30/2015 09:46 PM, Peter Hutterer wrote:
>> The current doubletap timeout was incorrect, it gave the user only
>> 180ms to
>> touch, release, touch, release to recognise a doubletap. But it would
>> also set
>> a timeout on the second release, delaying the button events by 180ms.
>>
>> Instead, re-arm the timer on the second touch down. This gives the
>> user 180ms
>> to release and touch again (or time out). This makes doubletap much more
>> reliable and reduces the delay between the release and the button events
>> arriving since the finger down time is already counted.
>>
>> Same fix for MULTITAP, though we already armed the timer on touch down
>> so we
>> just have to remove the new timer on touch release which did little
>> but delay
>> everything.
>>
>> https://bugs.freedesktop.org/show_bug.cgi?id=90172
>>
>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
>> ---
>> src/evdev-mt-touchpad-tap.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
>> index 7d1fc84..50e1512 100644
>> --- a/src/evdev-mt-touchpad-tap.c
>> +++ b/src/evdev-mt-touchpad-tap.c
>> @@ -224,6 +224,7 @@ tp_tap_tapped_handle_event(struct tp_dispatch *tp,
>> break;
>> case TAP_EVENT_TOUCH:
>> tp->tap.state = TAP_STATE_DRAGGING_OR_DOUBLETAP;
>> + tp_tap_set_timer(tp, time);
>> break;
>> case TAP_EVENT_TIMEOUT:
>> tp->tap.state = TAP_STATE_IDLE;
>> @@ -355,7 +356,6 @@ tp_tap_dragging_or_doubletap_handle_event(struct
>> tp_dispatch *tp,
>> case TAP_EVENT_RELEASE:
>> tp->tap.state = TAP_STATE_MULTITAP;
>> tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
>> - tp_tap_set_timer(tp, time);
>> break;
>> case TAP_EVENT_MOTION:
>> case TAP_EVENT_TIMEOUT:
>> @@ -487,7 +487,6 @@ tp_tap_multitap_down_handle_event(struct
>> tp_dispatch *tp,
>> case TAP_EVENT_RELEASE:
>> tp->tap.state = TAP_STATE_MULTITAP;
>> tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
>> - tp_tap_set_timer(tp, time);
>> break;
>> case TAP_EVENT_TOUCH:
>> tp->tap.state = TAP_STATE_DRAGGING_2;
>>
More information about the wayland-devel
mailing list