[PATCH libinput 1/3] touchpad: mask out ABS_MT if we don't have or disable MT

Hans de Goede hdegoede at redhat.com
Tue Jan 24 16:45:48 UTC 2017


Hi,

On 01/24/2017 06:46 AM, Peter Hutterer wrote:
> Make sure the events we deal with are the ones we actually honor. This reduces
> the chance that we accidentally process events we weren't event supposed to
> get based on some earlier device decision.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Patch-set looks good to me:

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

Regards,

Hans




> ---
>  src/evdev-mt-touchpad.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index f437c2d..ca00c40 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -1749,6 +1749,16 @@ tp_sync_touch(struct tp_dispatch *tp,
>  	libevdev_fetch_slot_value(evdev, slot, ABS_MT_DISTANCE, &t->distance);
>  }
>
> +static inline void
> +tp_disable_abs_mt(struct evdev_device *device)
> +{
> +	struct libevdev *evdev = device->evdev;
> +	unsigned int code;
> +
> +	for (code = ABS_MT_SLOT; code <= ABS_MAX; code++)
> +		libevdev_disable_event_code(evdev, EV_ABS, code);
> +}
> +
>  static bool
>  tp_init_slots(struct tp_dispatch *tp,
>  	      struct evdev_device *device)
> @@ -1804,6 +1814,9 @@ tp_init_slots(struct tp_dispatch *tp,
>  		tp->has_mt = false;
>  	}
>
> +	if (!tp->has_mt)
> +		tp_disable_abs_mt(device);
> +
>  	ARRAY_FOR_EACH(max_touches, m) {
>  		if (libevdev_has_event_code(device->evdev,
>  					    EV_KEY,
>


More information about the wayland-devel mailing list