[PATCH weston v4 07/20] libinput: Expose unaccelerated motion deltas in motion event struct

Peter Hutterer peter.hutterer at who-t.net
Wed Nov 18 18:23:14 PST 2015


On Tue, Nov 17, 2015 at 06:10:53PM +0800, Jonas Ådahl wrote:
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>  src/compositor.h      | 3 +++
>  src/libinput-device.c | 9 ++++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compositor.h b/src/compositor.h
> index 032c637..3b1f63e 100644
> --- a/src/compositor.h
> +++ b/src/compositor.h
> @@ -243,6 +243,7 @@ struct weston_output {
>  enum weston_pointer_motion_mask {
>  	WESTON_POINTER_MOTION_ABS = 1 << 0,
>  	WESTON_POINTER_MOTION_REL = 1 << 1,
> +	WESTON_POINTER_MOTION_REL_UNACCEL = 1 << 2,
>  };
>  
>  struct weston_pointer_motion_event {
> @@ -251,6 +252,8 @@ struct weston_pointer_motion_event {
>  	double y;
>  	double dx;
>  	double dy;
> +	double dx_unaccel;
> +	double dy_unaccel;
>  };
>  
>  struct weston_pointer_grab;
> diff --git a/src/libinput-device.c b/src/libinput-device.c
> index 7cc6a35..f60d1e0 100644
> --- a/src/libinput-device.c
> +++ b/src/libinput-device.c
> @@ -87,11 +87,18 @@ handle_pointer_motion(struct libinput_device *libinput_device,
>  	struct evdev_device *device =
>  		libinput_device_get_user_data(libinput_device);
>  	struct weston_pointer_motion_event event = { 0 };
> +	double dx_unaccel, dy_unaccel;
> +
> +	dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(pointer_event);
> +	dy_unaccel = libinput_event_pointer_get_dy_unaccelerated(pointer_event);
>  
>  	event = (struct weston_pointer_motion_event) {
> -		.mask = WESTON_POINTER_MOTION_REL,
> +		.mask = WESTON_POINTER_MOTION_REL |
> +			WESTON_POINTER_MOTION_REL_UNACCEL,
>  		.dx = libinput_event_pointer_get_dx(pointer_event),
>  		.dy = libinput_event_pointer_get_dy(pointer_event),
> +		.dx_unaccel = dx_unaccel,
> +		.dy_unaccel = dy_unaccel,

it'd probably be nicer to look at to add variables for dx/dy and have the
libinput calls grouped together, but either way:

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter

>  	};
>  
>  	notify_motion(device->seat,
> -- 
> 2.4.3
> 
> _______________________________________________
> 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