[PATCH] gestures: if fingers don't move, force a gesture by finger position

Hans de Goede hdegoede at redhat.com
Tue Dec 20 11:20:38 UTC 2016


Hi,

On 20-12-16 04:57, Peter Hutterer wrote:
> If the fingers rest on the touchpad without moving for a timeout, switch to
> pinch or swipe based on the finger position. We already did so for two-fingers
> switching to scrolling, now we also do so for 3 and 4 finger gestures. This
> gives us better reaction to small movements.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev-mt-touchpad-gestures.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
> index 6c568a3..e54db2a 100644
> --- a/src/evdev-mt-touchpad-gestures.c
> +++ b/src/evdev-mt-touchpad-gestures.c
> @@ -331,10 +331,10 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
>  	int yres = tp->device->abs.absinfo_y->resolution;
>  	int vert_distance;
>
> -	/* for two-finger gestures, if the fingers stay unmoving for a
> -	 * while, assume (slow) scroll */
> -	if (tp->gesture.finger_count == 2) {
> -		if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
> +	if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
> +		/* for two-finger gestures, if the fingers stay unmoving for a
> +		 * while, assume (slow) scroll */
> +		if (tp->gesture.finger_count == 2) {
>  			tp_gesture_set_scroll_buildup(tp);
>  			return GESTURE_STATE_SCROLL;
>  		}
> @@ -346,6 +346,8 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
>  		    tp->gesture.enabled) {
>  			tp_gesture_init_pinch(tp);
>  			return GESTURE_STATE_PINCH;
> +		} else {
> +			return GESTURE_STATE_SWIPE;
>  		}
>  	}
>
>

This change means that if 2 fingers are down and one finger is > 20mm below the others, we
will no longer immediately switch to pinch mode, as that test is now only done after the
timeout. I think that that is an unintended side-effect of this patch ?

Regards,

Hans





More information about the wayland-devel mailing list