[PATCH weston] libinput-device: use the new merged scroll events

Jonas Ådahl jadahl at gmail.com
Mon Jan 12 18:29:06 PST 2015


On Tue, Jan 13, 2015 at 11:55:37AM +1000, Peter Hutterer wrote:
> libinput now provides a single event for scroll events. Extract the axes from
> that event and split them into the wl events.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Reviewed-by: Jonas Ådahl <jadahl at gmail.com>

> ---
> Patch for the as yet unreleased libinput 0.8. Do not merge yet, it'll break
> the build.

Noted. It should be semi safe to push as long as it's on libinput
master. Weston master can depend libinput master, can't it, Pekka?

Jonas

> 
>  src/libinput-device.c | 25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/src/libinput-device.c b/src/libinput-device.c
> index 8a48905..e68b54d 100644
> --- a/src/libinput-device.c
> +++ b/src/libinput-device.c
> @@ -133,12 +133,27 @@ handle_pointer_axis(struct libinput_device *libinput_device,
>  	struct evdev_device *device =
>  		libinput_device_get_user_data(libinput_device);
>  	double value;
> +	enum libinput_pointer_axis axis;
>  
> -	value = libinput_event_pointer_get_axis_value(pointer_event);
> -	notify_axis(device->seat,
> -		    libinput_event_pointer_get_time(pointer_event),
> -		    libinput_event_pointer_get_axis(pointer_event),
> -		    wl_fixed_from_double(value));
> +	axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
> +	if (libinput_event_pointer_has_axis(pointer_event, axis)) {
> +		value = libinput_event_pointer_get_axis_value(pointer_event,
> +							      axis);
> +		notify_axis(device->seat,
> +			    libinput_event_pointer_get_time(pointer_event),
> +			    WL_POINTER_AXIS_VERTICAL_SCROLL,
> +			    wl_fixed_from_double(value));
> +	}
> +
> +	axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
> +	if (libinput_event_pointer_has_axis(pointer_event, axis)) {
> +		value = libinput_event_pointer_get_axis_value(pointer_event,
> +							      axis);
> +		notify_axis(device->seat,
> +			    libinput_event_pointer_get_time(pointer_event),
> +			    WL_POINTER_AXIS_HORIZONTAL_SCROLL,
> +			    wl_fixed_from_double(value));
> +	}
>  }
>  
>  static void
> -- 
> 2.1.0
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list