[PATCH libinput tablet] tablet: add get_time_usec() for tablets, switch to usec

Jonas Ådahl jadahl at gmail.com
Mon Aug 3 23:02:54 PDT 2015


On Tue, Aug 04, 2015 at 02:10:16PM +1000, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

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

> ---
>  src/evdev-tablet.c     | 16 ++++++++--------
>  src/libinput-private.h |  6 +++---
>  src/libinput.c         | 14 ++++++++++----
>  src/libinput.h         |  9 +++++++++
>  src/libinput.sym       |  1 +
>  5 files changed, 31 insertions(+), 15 deletions(-)
> 
> diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
> index 2904fbb..851d49d 100644
> --- a/src/evdev-tablet.c
> +++ b/src/evdev-tablet.c
> @@ -107,7 +107,7 @@ static void
>  tablet_process_absolute(struct tablet_dispatch *tablet,
>  			struct evdev_device *device,
>  			struct input_event *e,
> -			uint32_t time)
> +			uint64_t time)
>  {
>  	enum libinput_tablet_axis axis;
>  
> @@ -316,7 +316,7 @@ get_delta(enum libinput_tablet_axis axis, double current, double old)
>  static void
>  tablet_check_notify_axes(struct tablet_dispatch *tablet,
>  			 struct evdev_device *device,
> -			 uint32_t time,
> +			 uint64_t time,
>  			 struct libinput_tool *tool)
>  {
>  	struct libinput_device *base = &device->base;
> @@ -478,7 +478,7 @@ static void
>  tablet_process_key(struct tablet_dispatch *tablet,
>  		   struct evdev_device *device,
>  		   struct input_event *e,
> -		   uint32_t time)
> +		   uint64_t time)
>  {
>  	switch (e->code) {
>  	case BTN_TOOL_PEN:
> @@ -521,7 +521,7 @@ static void
>  tablet_process_relative(struct tablet_dispatch *tablet,
>  			struct evdev_device *device,
>  			struct input_event *e,
> -			uint32_t time)
> +			uint64_t time)
>  {
>  	enum libinput_tablet_axis axis;
>  
> @@ -551,7 +551,7 @@ static void
>  tablet_process_misc(struct tablet_dispatch *tablet,
>  		    struct evdev_device *device,
>  		    struct input_event *e,
> -		    uint32_t time)
> +		    uint64_t time)
>  {
>  	switch (e->code) {
>  	case MSC_SERIAL:
> @@ -779,7 +779,7 @@ tablet_get_tool(struct tablet_dispatch *tablet,
>  static void
>  tablet_notify_button_mask(struct tablet_dispatch *tablet,
>  			  struct evdev_device *device,
> -			  uint32_t time,
> +			  uint64_t time,
>  			  struct libinput_tool *tool,
>  			  const unsigned char *buttons,
>  			  unsigned int buttons_len,
> @@ -805,7 +805,7 @@ tablet_notify_button_mask(struct tablet_dispatch *tablet,
>  static void
>  tablet_notify_buttons(struct tablet_dispatch *tablet,
>  		      struct evdev_device *device,
> -		      uint32_t time,
> +		      uint64_t time,
>  		      struct libinput_tool *tool,
>  		      enum libinput_button_state state)
>  {
> @@ -864,7 +864,7 @@ sanitize_tablet_axes(struct tablet_dispatch *tablet)
>  static void
>  tablet_flush(struct tablet_dispatch *tablet,
>  	     struct evdev_device *device,
> -	     uint32_t time)
> +	     uint64_t time)
>  {
>  	struct libinput_tool *tool =
>  		tablet_get_tool(tablet,
> diff --git a/src/libinput-private.h b/src/libinput-private.h
> index 69ed26e..d9ba7d2 100644
> --- a/src/libinput-private.h
> +++ b/src/libinput-private.h
> @@ -432,7 +432,7 @@ touch_notify_frame(struct libinput_device *device,
>  
>  void
>  tablet_notify_axis(struct libinput_device *device,
> -		   uint32_t time,
> +		   uint64_t time,
>  		   struct libinput_tool *tool,
>  		   unsigned char *changed_axes,
>  		   double *axes,
> @@ -441,7 +441,7 @@ tablet_notify_axis(struct libinput_device *device,
>  
>  void
>  tablet_notify_proximity(struct libinput_device *device,
> -			uint32_t time,
> +			uint64_t time,
>  			struct libinput_tool *tool,
>  			enum libinput_tool_proximity_state state,
>  			unsigned char *changed_axes,
> @@ -449,7 +449,7 @@ tablet_notify_proximity(struct libinput_device *device,
>  
>  void
>  tablet_notify_button(struct libinput_device *device,
> -		     uint32_t time,
> +		     uint64_t time,
>  		     struct libinput_tool *tool,
>  		     double *axes,
>  		     int32_t button,
> diff --git a/src/libinput.c b/src/libinput.c
> index 3557b8f..46578fe 100644
> --- a/src/libinput.c
> +++ b/src/libinput.c
> @@ -130,7 +130,7 @@ struct libinput_event_tablet {
>  	uint32_t button;
>  	enum libinput_button_state state;
>  	uint32_t seat_button_count;
> -	uint32_t time;
> +	uint64_t time;
>  	double axes[LIBINPUT_TABLET_AXIS_MAX + 1];
>  	double deltas[LIBINPUT_TABLET_AXIS_MAX + 1];
>  	double deltas_discrete[LIBINPUT_TABLET_AXIS_MAX + 1];
> @@ -1022,6 +1022,12 @@ libinput_event_tablet_get_proximity_state(struct libinput_event_tablet *event)
>  LIBINPUT_EXPORT uint32_t
>  libinput_event_tablet_get_time(struct libinput_event_tablet *event)
>  {
> +	return us2ms(event->time);
> +}
> +
> +LIBINPUT_EXPORT uint64_t
> +libinput_event_tablet_get_time_usec(struct libinput_event_tablet *event)
> +{
>  	return event->time;
>  }
>  
> @@ -1841,7 +1847,7 @@ touch_notify_frame(struct libinput_device *device,
>  
>  void
>  tablet_notify_axis(struct libinput_device *device,
> -		   uint32_t time,
> +		   uint64_t time,
>  		   struct libinput_tool *tool,
>  		   unsigned char *changed_axes,
>  		   double *axes,
> @@ -1876,7 +1882,7 @@ tablet_notify_axis(struct libinput_device *device,
>  
>  void
>  tablet_notify_proximity(struct libinput_device *device,
> -			uint32_t time,
> +			uint64_t time,
>  			struct libinput_tool *tool,
>  			enum libinput_tool_proximity_state proximity_state,
>  			unsigned char *changed_axes,
> @@ -1910,7 +1916,7 @@ tablet_notify_proximity(struct libinput_device *device,
>  
>  void
>  tablet_notify_button(struct libinput_device *device,
> -		     uint32_t time,
> +		     uint64_t time,
>  		     struct libinput_tool *tool,
>  		     double *axes,
>  		     int32_t button,
> diff --git a/src/libinput.h b/src/libinput.h
> index 212ee35..d983455 100644
> --- a/src/libinput.h
> +++ b/src/libinput.h
> @@ -1544,6 +1544,15 @@ libinput_event_tablet_get_time(struct libinput_event_tablet *event);
>  /**
>   * @ingroup event_tablet
>   *
> + * @param event The libinput tablet event
> + * @return The event time for this event in microseconds
> + */
> +uint64_t
> +libinput_event_tablet_get_time_usec(struct libinput_event_tablet *event);
> +
> +/**
> + * @ingroup event_tablet
> + *
>   * Return the type of tool type for a tool object
>   *
>   * @param tool The libinput tool
> diff --git a/src/libinput.sym b/src/libinput.sym
> index 1529547..8480024 100644
> --- a/src/libinput.sym
> +++ b/src/libinput.sym
> @@ -191,6 +191,7 @@ LIBINPUT_TABLET_SUPPORT {
>  	libinput_event_tablet_get_tool;
>  	libinput_event_tablet_get_x_transformed;
>  	libinput_event_tablet_get_y_transformed;
> +	libinput_event_tablet_get_time_usec;
>  	libinput_tool_get_serial;
>  	libinput_tool_get_tool_id;
>  	libinput_tool_get_type;
> -- 
> 2.4.3
> 


More information about the wayland-devel mailing list