[PATCH libinput 07/10] evdev: hook into pointer acceleration config interface
Hans de Goede
hdegoede at redhat.com
Fri Sep 19 00:17:03 PDT 2014
Hi,
On 09/19/2014 07:44 AM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> src/evdev.c | 39 +++++++++++++++++++++++++++++++++++++++
> src/evdev.h | 1 +
> 2 files changed, 40 insertions(+)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index de7ee16..eb570e2 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -861,6 +861,39 @@ evdev_device_dispatch(void *data)
> }
>
> static int
> +evdev_accel_config_available(struct libinput_device *device)
> +{
> + /* this function is only called if we set up ptraccel, so we can
> + reply with a resounding "Yes" */
> + return 1;
> +}
> +
> +static enum libinput_config_status
> +evdev_accel_config_set_speed(struct libinput_device *device, double speed)
> +{
> + struct evdev_device *dev = (struct evdev_device *)device;
> +
> + if (!filter_set_speed(dev->pointer.filter, speed))
> + return LIBINPUT_CONFIG_STATUS_INVALID;
> +
> + return LIBINPUT_CONFIG_STATUS_SUCCESS;
> +}
> +
> +static double
> +evdev_accel_config_get_speed(struct libinput_device *device)
> +{
> + struct evdev_device *dev = (struct evdev_device *)device;
> +
> + return filter_get_speed(dev->pointer.filter);
> +}
> +
> +static double
> +evdev_accel_config_get_default_speed(struct libinput_device *device)
> +{
> + return 0;
0.0 please, otherwise looks good:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> +}
> +
> +static int
> configure_pointer_acceleration(struct evdev_device *device)
> {
> device->pointer.filter =
> @@ -869,6 +902,12 @@ configure_pointer_acceleration(struct evdev_device *device)
> if (!device->pointer.filter)
> return -1;
>
> + device->pointer.config.available = evdev_accel_config_available;
> + device->pointer.config.set_speed = evdev_accel_config_set_speed;
> + device->pointer.config.get_speed = evdev_accel_config_get_speed;
> + device->pointer.config.get_default_speed = evdev_accel_config_get_default_speed;
> + device->base.config.accel = &device->pointer.config;
> +
> return 0;
> }
>
> diff --git a/src/evdev.h b/src/evdev.h
> index 2da30f8..301903a 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -114,6 +114,7 @@ struct evdev_device {
> int suspended;
>
> struct {
> + struct libinput_device_config_accel config;
> struct motion_filter *filter;
> } pointer;
>
>
More information about the wayland-devel
mailing list