[PATCH libinput v2] tablet: Include axes with all events

Peter Hutterer peter.hutterer at who-t.net
Thu Jun 26 01:03:26 PDT 2014


On Thu, Jun 26, 2014 at 02:39:09AM -0400, Stephen Chandler Paul wrote:
> Forgot to update the documentation for libinput_event_tablet_get_axis(), fixed
> 
> Signed-off-by: Stephen Chandler Paul <thatslyude at gmail.com>


I have a patch in my tree here that I want to merge before this one:
This code below is buggy (as is the current axis event) because the axes
keep updating as we process events, so the event state isn't correct when
the client reads it. So we need to memcpy the axes into the event instead.
Please fix this patch up likewise before we merge it.

Otherwise this looks good.

Cheers,
   Peter

> ---
>  src/evdev-tablet.c     | 11 +++++++++--
>  src/libinput-private.h |  7 +++++--
>  src/libinput.c         | 10 ++++++++--
>  src/libinput.h         |  3 ---
>  4 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
> index c754060..de8d8cb 100644
> --- a/src/evdev-tablet.c
> +++ b/src/evdev-tablet.c
> @@ -314,6 +314,7 @@ tablet_notify_button_mask(struct tablet_dispatch *tablet,
>  		tablet_notify_button(base,
>  				     time,
>  				     tool,
> +				     tablet->axes,
>  				     num_button + button_base - 1,
>  				     state);
>  	}
> @@ -390,7 +391,10 @@ tablet_flush(struct tablet_dispatch *tablet,
>  		tablet->button_state.stylus_buttons = 0;
>  		tablet_set_status(tablet, TABLET_BUTTONS_RELEASED);
>  	} else if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) {
> -		tablet_notify_proximity_in(&device->base, time, tool);
> +		tablet_notify_proximity_in(&device->base,
> +					   time,
> +					   tool,
> +					   tablet->axes);
>  		tablet_unset_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY);
>  	}
>  
> @@ -419,7 +423,10 @@ tablet_flush(struct tablet_dispatch *tablet,
>  	}
>  
>  	if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) {
> -		tablet_notify_proximity_out(&device->base, time, tool);
> +		tablet_notify_proximity_out(&device->base,
> +					    time,
> +					    tool,
> +					    tablet->axes);
>  		tablet_set_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY);
>  		tablet_unset_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY);
>  	}
> diff --git a/src/libinput-private.h b/src/libinput-private.h
> index d429ad3..4efbdfe 100644
> --- a/src/libinput-private.h
> +++ b/src/libinput-private.h
> @@ -220,17 +220,20 @@ tablet_notify_axis(struct libinput_device *device,
>  void
>  tablet_notify_proximity_in(struct libinput_device *device,
>  			   uint32_t time,
> -			   struct libinput_tool *tool);
> +			   struct libinput_tool *tool,
> +			   double *axes);
>  
>  void
>  tablet_notify_proximity_out(struct libinput_device *device,
>  			    uint32_t time,
> -			    struct libinput_tool *tool);
> +			    struct libinput_tool *tool,
> +			    double *axes);
>  
>  void
>  tablet_notify_button(struct libinput_device *device,
>  		     uint32_t time,
>  		     struct libinput_tool *tool,
> +		     double *axes,
>  		     int32_t button,
>  		     enum libinput_button_state state);
>  void
> diff --git a/src/libinput.c b/src/libinput.c
> index d7adfac..f9bb2ce 100644
> --- a/src/libinput.c
> +++ b/src/libinput.c
> @@ -1237,7 +1237,8 @@ tablet_notify_axis(struct libinput_device *device,
>  void
>  tablet_notify_proximity_in(struct libinput_device *device,
>  			   uint32_t time,
> -			   struct libinput_tool *tool)
> +			   struct libinput_tool *tool,
> +			   double *axes)
>  {
>  	struct libinput_event_tablet *proximity_in_event;
>  
> @@ -1248,6 +1249,7 @@ tablet_notify_proximity_in(struct libinput_device *device,
>  	*proximity_in_event = (struct libinput_event_tablet) {
>  		.time = time,
>  		.tool = tool,
> +		.axes = axes,
>  	};
>  
>  	post_device_event(device,
> @@ -1258,7 +1260,8 @@ tablet_notify_proximity_in(struct libinput_device *device,
>  void
>  tablet_notify_proximity_out(struct libinput_device *device,
>  			    uint32_t time,
> -			    struct libinput_tool *tool)
> +			    struct libinput_tool *tool,
> +			    double *axes)
>  {
>  	struct libinput_event_tablet *proximity_out_update_event;
>  
> @@ -1269,6 +1272,7 @@ tablet_notify_proximity_out(struct libinput_device *device,
>  	*proximity_out_update_event = (struct libinput_event_tablet) {
>  		.time = time,
>  		.tool = tool,
> +		.axes = axes,
>  	};
>  
>  	post_device_event(device,
> @@ -1280,6 +1284,7 @@ void
>  tablet_notify_button(struct libinput_device *device,
>  		     uint32_t time,
>  		     struct libinput_tool *tool,
> +		     double *axes,
>  		     int32_t button,
>  		     enum libinput_button_state state)
>  {
> @@ -1297,6 +1302,7 @@ tablet_notify_button(struct libinput_device *device,
>  	*button_event = (struct libinput_event_tablet) {
>  		.time = time,
>  		.tool = tool,
> +		.axes = axes,
>  		.button = button,
>  		.state = state,
>  		.seat_button_count = seat_button_count,
> diff --git a/src/libinput.h b/src/libinput.h
> index f454af1..47f8fc4 100644
> --- a/src/libinput.h
> +++ b/src/libinput.h
> @@ -876,9 +876,6 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event,
>   *   that indicates the tilt vertical or horizontal tilt of the tool
>   *   respectively
>   *
> - * For tablet events that are not of type @ref LIBINPUT_EVENT_TABLET_AXIS, this
> - * function returns 0.
> - *
>   * @param event The libinput tablet event
>   * @param axis The axis to retrieve the value of
>   * @return The current value of the the axis
> -- 
> 1.8.5.5
> 


More information about the wayland-devel mailing list