[PATCH v2 libinput 1/2] touchpad: drop the tap finger count

Hans de Goede hdegoede at redhat.com
Mon May 4 07:04:38 PDT 2015


Hi,

On 05/04/2015 12:37 PM, Peter Hutterer wrote:
> Use tp->nfingers_down as trigger when we have no fingers left on the touchpad
> and when we should return to idle. If all touchpoints end in the same frame
> tp->nfingers is 0. Thus when we handle the first tap release we transition to
> IDLE which now needs to handle (and discard) any touch release events.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Series looks good and is:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans

> ---
>   src/evdev-mt-touchpad-tap.c | 6 ++----
>   src/evdev-mt-touchpad.h     | 1 -
>   2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
> index 70c45ff..61f94e5 100644
> --- a/src/evdev-mt-touchpad-tap.c
> +++ b/src/evdev-mt-touchpad-tap.c
> @@ -154,6 +154,7 @@ tp_tap_idle_handle_event(struct tp_dispatch *tp,
>   		tp_tap_set_timer(tp, time);
>   		break;
>   	case TAP_EVENT_RELEASE:
> +		break;
>   	case TAP_EVENT_MOTION:
>   		log_bug_libinput(libinput,
>   				 "invalid tap event, no fingers are down\n");
> @@ -531,7 +532,7 @@ tp_tap_dead_handle_event(struct tp_dispatch *tp,
>
>   	switch (event) {
>   	case TAP_EVENT_RELEASE:
> -		if (tp->tap.tap_finger_count == 0)
> +		if (tp->nfingers_down == 0)
>   			tp->tap.state = TAP_STATE_IDLE;
>   		break;
>   	case TAP_EVENT_TOUCH:
> @@ -652,7 +653,6 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
>   			t->tap.state = TAP_TOUCH_STATE_DEAD;
>
>   		if (t->state == TOUCH_BEGIN) {
> -			tp->tap.tap_finger_count++;
>   			t->tap.state = TAP_TOUCH_STATE_TOUCH;
>   			t->tap.initial = t->point;
>   			tp_tap_handle_event(tp, t, TAP_EVENT_TOUCH, time);
> @@ -665,7 +665,6 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
>   				tp_tap_handle_event(tp, t, TAP_EVENT_MOTION, time);
>
>   		} else if (t->state == TOUCH_END) {
> -			tp->tap.tap_finger_count--;
>   			tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time);
>   			t->tap.state = TAP_TOUCH_STATE_IDLE;
>   		} else if (tp->tap.state != TAP_STATE_IDLE &&
> @@ -850,7 +849,6 @@ tp_release_all_taps(struct tp_dispatch *tp, uint64_t now)
>   	}
>
>   	tp->tap.state = tp->nfingers_down ? TAP_STATE_DEAD : TAP_STATE_IDLE;
> -	tp->tap.tap_finger_count = 0;
>   }
>
>   void
> diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
> index 97b17cd..d4f5874 100644
> --- a/src/evdev-mt-touchpad.h
> +++ b/src/evdev-mt-touchpad.h
> @@ -257,7 +257,6 @@ struct tp_dispatch {
>   		struct libinput_timer timer;
>   		enum tp_tap_state state;
>   		uint32_t buttons_pressed;
> -		unsigned int tap_finger_count;
>   		uint64_t multitap_last_time;
>   	} tap;
>
>


More information about the wayland-devel mailing list