[PATCH libinput 08/10] touchpad: hook up pointer acceleration configuration

Hans de Goede hdegoede at redhat.com
Fri Sep 19 00:18:26 PDT 2014


Hi,

On 09/19/2014 07:44 AM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>> ---

This is exactly the same code as in src/evdev.c since evdev-mt-touchpad
derives from evdev, can't it re-use that code somehow ?

Regards,

Hans


>  src/evdev-mt-touchpad.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
> 
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 0b51809..5637774 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -801,6 +801,45 @@ tp_init_slots(struct tp_dispatch *tp,
>  }
>  
>  static int
> +tp_accel_config_available(struct libinput_device *device)
> +{
> +	return 1;
> +}
> +
> +static enum libinput_config_status
> +tp_accel_config_set_speed(struct libinput_device *device, double speed)
> +{
> +	struct evdev_dispatch *dispatch;
> +	struct tp_dispatch *tp;
> +
> +	dispatch = ((struct evdev_device *) device)->dispatch;
> +	tp = container_of(dispatch, tp, base);
> +
> +	if (!filter_set_speed(tp->filter, speed))
> +		return LIBINPUT_CONFIG_STATUS_INVALID;
> +
> +	return LIBINPUT_CONFIG_STATUS_SUCCESS;
> +}
> +
> +static double
> +tp_accel_config_get_speed(struct libinput_device *device)
> +{
> +	struct evdev_dispatch *dispatch;
> +	struct tp_dispatch *tp;
> +
> +	dispatch = ((struct evdev_device *) device)->dispatch;
> +	tp = container_of(dispatch, tp, base);
> +
> +	return filter_get_speed(tp->filter);
> +}
> +
> +static double
> +tp_accel_config_get_default_speed(struct libinput_device *device)
> +{
> +	return 0;
> +}
> +
> +static int
>  tp_init_accel(struct tp_dispatch *tp, double diagonal)
>  {
>  	struct motion_filter *accel;
> @@ -847,6 +886,12 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
>  
>  	tp->filter = accel;
>  
> +	tp->device->pointer.config.available = tp_accel_config_available;
> +	tp->device->pointer.config.set_speed = tp_accel_config_set_speed;
> +	tp->device->pointer.config.get_speed = tp_accel_config_get_speed;
> +	tp->device->pointer.config.get_default_speed = tp_accel_config_get_default_speed;
> +	tp->device->base.config.accel = &tp->device->pointer.config;
> +
>  	return 0;
>  }
>  
> 


More information about the wayland-devel mailing list