[PATCH libinput 11/11] touchpad: put a movement threshold on thumb detection
Hans de Goede
hdegoede at redhat.com
Thu Jul 23 00:40:49 PDT 2015
Hi,
On 23-07-15 04:31, Peter Hutterer wrote:
> On Wed, Jul 22, 2015 at 03:54:02PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 22-07-15 07:09, Peter Hutterer wrote:
>>> If a thumb moves around, it's not resting and we should consider it a normal
>>> touch.
>>>
>>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
>>> ---
>>> src/evdev-mt-touchpad.c | 16 ++++++++++++++++
>>> src/evdev-mt-touchpad.h | 1 +
>>> test/touchpad.c | 31 ++++++++++++++++++++++++++++---
>>> 3 files changed, 45 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
>>> index 0b39bf6..63ce488 100644
>>> --- a/src/evdev-mt-touchpad.c
>>> +++ b/src/evdev-mt-touchpad.c
>>> @@ -636,6 +636,22 @@ tp_thumb_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
>>> goto out;
>>> }
>>>
>>> + /* If the thumb moves by more than 7mm, it's not a resting thumb */
>>> + if (t->state == TOUCH_BEGIN)
>>> + t->thumb.initial = t->point;
>>> + else if (t->state == TOUCH_UPDATE) {
>>> + struct device_float_coords delta;
>>> + struct normalized_coords normalized;
>>> +
>>> + delta = device_delta(t->point, t->thumb.initial);
>>> + normalized = tp_normalize_delta(tp, delta);
>>> + if (normalized_length(normalized) >
>>> + TP_MM_TO_DPI_NORMALIZED(7)) {
>>> + t->thumb.state = THUMB_STATE_NO;
>>> + goto out;
>>> + }
>>> + }
>>> +
>>> /* Note: a thumb at the edge of the touchpad won't trigger the
>>> * threshold, the surface area is usually too small. So we have a
>>> * two-stage detection: pressure and time within the area.
>>
>> If you want this to mark thouches with THUMB_STATE_YES as THUMB_STATE_NO
>> this needs to be above the:
>>
>> /* once a thumb, always a thumb, once ruled out always ruled out */
>> if (!tp->thumb.detect_thumbs ||
>> t->thumb.state != THUMB_STATE_MAYBE)
>> return;
>>
>> Block, and maybe the commentline above the if() of that block needs to
>> be updated too ...
>
> see my comment to the other patch, for now I'd like to leave it as "once a
> thumb, always a thumb".
Ok.
>> Also does this commit not require updates to the svg with the thumb detect
>> statemachine ?
>
> the svg in the other patch is a graphic for the documentation page, not a
> state diagram. the state machine is simple enough (and constrained to a
> single function) that I didn't bother with a state diagram.
Ah, ok. In that case:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
For both patch 7 and 11 (this one).
Regards,
Hans
More information about the wayland-devel
mailing list