[PATCH libinput 6/6] touchpad: pretend the jumpy semi-mt touchpad is a single-touch touchpad

Hans de Goede hdegoede at redhat.com
Thu Jul 30 05:33:08 PDT 2015


Hi,

On 30-07-15 08:11, Peter Hutterer wrote:
> The first finger is accurate, it's just the second finger that is imprecise,
> so we can't handle it as a true touch. Instead, revert the device back to
> being a single-touch touchpad and use the fake touch bits for second finger
> handling.
>
> Two-finger scrolling thus becomes usable though we will lose out on
> other features like thumb detection. Useful scrolling trumps that though.

I think we should wait with doing this until the scroll situation is more
clear, see my last comment here:

https://bugzilla.redhat.com/show_bug.cgi?id=1235175

If the first touch is accurate even when 2 fingers are down then there
then things should already work, as we only look at the first touch for 2fg
scrolling on semi-mt touchpads, or at least we should be ...

If the first touch becomes unreliable when 2 fingers are down then
depending this is a single touch device will not help.

Regards,

Hans


>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>   src/evdev-mt-touchpad.c | 19 ++++++++++++++-----
>   test/touchpad-tap.c     |  3 +++
>   test/touchpad.c         |  9 +++------
>   3 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index af1cd47..54ea819 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -1465,6 +1465,19 @@ tp_init_slots(struct tp_dispatch *tp,
>
>   	tp->semi_mt = libevdev_has_property(device->evdev, INPUT_PROP_SEMI_MT);
>
> +	/* This device has a terrible 2fg resolution, but only for the
> +	 * second finger, causing scroll jumps when we use the touch points
> +	 * properly. The first finger resolution is accurate though, so
> +	 * we simply pretend it's a single touch touchpad with the BTN_TOOL
> +	 * bits.
> +	 */
> +	if (tp->semi_mt &&
> +	    (device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT)) {
> +		tp->num_slots = 1;
> +		tp->slot = 0;
> +		tp->has_mt = false;
> +	}
> +
>   	ARRAY_FOR_EACH(max_touches, m) {
>   		if (libevdev_has_event_code(device->evdev,
>   					    EV_KEY,
> @@ -1526,11 +1539,7 @@ tp_scroll_get_methods(struct tp_dispatch *tp)
>   {
>   	uint32_t methods = LIBINPUT_CONFIG_SCROLL_EDGE;
>
> -	/* some Synaptics semi-mt touchpads have a terrible 2fg resolution,
> -	 * causing scroll jumps. For all other 2fg touchpads, we enable 2fg
> -	 * scrolling */
> -	if (tp->ntouches >= 2 &&
> -	    (tp->device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT) == 0)
> +	if (tp->ntouches >= 2)
>   		methods |= LIBINPUT_CONFIG_SCROLL_2FG;
>
>   	return methods;
> diff --git a/test/touchpad-tap.c b/test/touchpad-tap.c
> index 00afcdb..62c7a5c 100644
> --- a/test/touchpad-tap.c
> +++ b/test/touchpad-tap.c
> @@ -241,6 +241,9 @@ START_TEST(touchpad_1fg_multitap_n_drag_2fg)
>   	int range = _i,
>   	    ntaps;
>
> +	if (litest_is_synaptics_semi_mt(dev))
> +		return;
> +
>   	litest_enable_tap(dev->libinput_device);
>
>   	litest_drain_events(li);
> diff --git a/test/touchpad.c b/test/touchpad.c
> index a6989e7..77c1d2d 100644
> --- a/test/touchpad.c
> +++ b/test/touchpad.c
> @@ -402,14 +402,12 @@ START_TEST(touchpad_scroll_defaults)
>
>   	method = libinput_device_config_scroll_get_methods(device);
>   	ck_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE);
> -	if (libevdev_get_num_slots(evdev) > 1 &&
> -	    !litest_is_synaptics_semi_mt(dev))
> +	if (libevdev_get_num_slots(evdev) > 1)
>   		ck_assert(method & LIBINPUT_CONFIG_SCROLL_2FG);
>   	else
>   		ck_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0);
>
> -	if (libevdev_get_num_slots(evdev) > 1 &&
> -	    !litest_is_synaptics_semi_mt(dev))
> +	if (libevdev_get_num_slots(evdev) > 1)
>   		expected = LIBINPUT_CONFIG_SCROLL_2FG;
>   	else
>   		expected = LIBINPUT_CONFIG_SCROLL_EDGE;
> @@ -425,8 +423,7 @@ START_TEST(touchpad_scroll_defaults)
>   	status = libinput_device_config_scroll_set_method(device,
>   					  LIBINPUT_CONFIG_SCROLL_2FG);
>
> -	if (libevdev_get_num_slots(evdev) > 1 &&
> -	    !litest_is_synaptics_semi_mt(dev))
> +	if (libevdev_get_num_slots(evdev) > 1)
>   		ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
>   	else
>   		ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
>


More information about the wayland-devel mailing list