[PATCH libinput 10/20] touchpad: Add tp_button_touch_active function

Hans de Goede hdegoede at redhat.com
Tue May 20 03:09:07 PDT 2014


Hi,

On 04/24/2014 07:21 AM, Peter Hutterer wrote:
> On Tue, Apr 15, 2014 at 02:28:07PM +0200, Hans de Goede wrote:
>> We don't want touches in the button area to cause the pointer to move, add
>> a tp_button_touch_active function which the main code in evdev-mt-touchpad
>> can call to see if a touch should be consider a candidate for being the
>> pointer, should be taken into account for 2 finger scrolling, etc.
>>
>> The idea behind the main code polling for this is that in the future with
>> ie edge scrolling we will have another independent state machine, which
>> may also want to block a touch from being the pointer, so it is best for
>> the main code to test all independent state machines, rather then having
>> the state-machines poke the is_pointer variabel directly.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
>> ---
>>  src/evdev-mt-touchpad-buttons.c | 5 +++++
>>  src/evdev-mt-touchpad.h         | 3 +++
>>  2 files changed, 8 insertions(+)
>>
>> diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
>> index f953cd1..e789a87 100644
>> --- a/src/evdev-mt-touchpad-buttons.c
>> +++ b/src/evdev-mt-touchpad-buttons.c
>> @@ -602,3 +602,8 @@ tp_post_button_events(struct tp_dispatch *tp, uint32_t time)
>>  	return rc;
>>  }
>>  
>> +int
>> +tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
>> +{
>> +	return t->button.state == BUTTON_STATE_AREA;
>> +}
>> diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
>> index 8d8dd84..04da6a6 100644
>> --- a/src/evdev-mt-touchpad.h
>> +++ b/src/evdev-mt-touchpad.h
>> @@ -229,4 +229,7 @@ tp_post_button_events(struct tp_dispatch *tp, uint32_t time);
>>  int
>>  tp_button_handle_state(struct tp_dispatch *tp, uint32_t time);
>>  
>> +int
>> +tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
>> +
>>  #endif
>> -- 
>> 1.9.0
>  
> There's a bit missing here, but it's not exposed until the next patch:
> for single-touch touchpads, button.state is never set because all
> touches are marked as fake. It remains on state NONE and thus never
> contributes to tp_button_touch_active. From what I can tell, the
> if (fake) continue; bit in tp_button_handle_state is superfluous anyway, the
> top area is INT_MAX, so we can likely just drop this.

After a bit of a pause I'm back to working on this. I agree that this bit can
and should just be dropped, I've done so in my local tree / for the next
version of this patch-set.

Regards,

Hans


More information about the wayland-devel mailing list