[PATCH libinput] touchpad: drop distance threshold to detect pinches

Hans de Goede hdegoede at redhat.com
Wed Jul 29 01:58:47 PDT 2015


Hi,

On 29-07-15 01:12, Peter Hutterer wrote:
> This gives us too many false positives of 2fg scroll being detected as pinch
> gesture. Reporter in [1] uses index+ring finger and thus exceeds the distance
> easily (that's admittedly a special case).
>
> This is worsed by the lack of a client stack that handles the gestures. User's
> don't see that they're inadvertently performing a gesture, they just see 2fg
> scroll not working.
>
> Drop the distance for now, once we have a ubiquitous client stack we can
> revisit and bring it back.
>
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1246868
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>   src/evdev-mt-touchpad-gestures.c | 17 +----------------
>   1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
> index 1acf111..2eedb14 100644
> --- a/src/evdev-mt-touchpad-gestures.c
> +++ b/src/evdev-mt-touchpad-gestures.c
> @@ -264,26 +264,11 @@ tp_gesture_twofinger_handle_state_none(struct tp_dispatch *tp, uint64_t time)
>   static enum tp_gesture_2fg_state
>   tp_gesture_twofinger_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
>   {
> -	struct normalized_coords normalized;
> -	struct device_float_coords delta;
>   	struct tp_touch *first = tp->gesture.touches[0],
>   			*second = tp->gesture.touches[1];
>   	int dir1, dir2;
>
> -	delta = device_delta(first->point, second->point);
> -	normalized = tp_normalize_delta(tp, delta);
> -
> -	/* If fingers are further than 3 cm apart assume pinch */
> -	if (normalized_length(normalized) > TP_MM_TO_DPI_NORMALIZED(30)) {
> -		tp_gesture_get_pinch_info(tp,
> -					  &tp->gesture.initial_distance,
> -					  &tp->gesture.angle,
> -					  &tp->gesture.center);
> -		tp->gesture.prev_scale = 1.0;
> -		return GESTURE_2FG_STATE_PINCH;
> -	}
> -
> -	/* Elif fingers have been close together for a while, scroll */
> +	/* if fingers have been close together for a while, scroll */

This comment now no longer makes sense it should be something like:

	/* If fingers stay in the same place for a while assume a (slow) scroll */

Other then that this looks good to me:

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

Regards,

Hans


>   	if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
>   		tp_gesture_set_scroll_buildup(tp);
>   		return GESTURE_2FG_STATE_SCROLL;
>


More information about the wayland-devel mailing list