[PATCH libinput] tablet: allow the various get_<axis> on tablet button events
Jason Gerecke
killertofu at gmail.com
Fri Jan 15 14:45:54 PST 2016
On Wed, Jan 13, 2016 at 8:22 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> There's no reason to prevent this for button events. Unlike the pointer
> which is a relative device a tablet is (usually) a device with a lot of state.
> Caller code that handles axes is likely shared between the various events,
> treating button events separately here doesn't get us any benefit.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Still not convinced about providing axis info in the tip and button
events, but its not my API to design :D
Acked-by: Jason Gerecke <jason.gerecke at wacom.com>
Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....
> ---
> src/libinput.c | 12 ++++++++++++
> src/libinput.h | 27 ++++++++++++++++++---------
> 2 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/src/libinput.c b/src/libinput.c
> index d73637a..01e171d 100644
> --- a/src/libinput.c
> +++ b/src/libinput.c
> @@ -921,6 +921,7 @@ libinput_event_tablet_tool_x_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -936,6 +937,7 @@ libinput_event_tablet_tool_y_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -951,6 +953,7 @@ libinput_event_tablet_tool_pressure_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -966,6 +969,7 @@ libinput_event_tablet_tool_distance_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -981,6 +985,7 @@ libinput_event_tablet_tool_tilt_x_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -996,6 +1001,7 @@ libinput_event_tablet_tool_tilt_y_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -1011,6 +1017,7 @@ libinput_event_tablet_tool_rotation_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -1026,6 +1033,7 @@ libinput_event_tablet_tool_slider_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -1041,6 +1049,7 @@ libinput_event_tablet_tool_wheel_has_changed(
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return bit_is_set(event->changed_axes,
> @@ -1059,6 +1068,7 @@ libinput_event_tablet_tool_get_axis_value(struct libinput_event_tablet_tool *eve
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> switch(axis) {
> @@ -1177,6 +1187,7 @@ libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool *
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return evdev_device_transform_x(device,
> @@ -1196,6 +1207,7 @@ libinput_event_tablet_tool_get_y_transformed(struct libinput_event_tablet_tool *
> 0,
> LIBINPUT_EVENT_TABLET_TOOL_AXIS,
> LIBINPUT_EVENT_TABLET_TOOL_TIP,
> + LIBINPUT_EVENT_TABLET_TOOL_BUTTON,
> LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
>
> return evdev_device_transform_y(device,
> diff --git a/src/libinput.h b/src/libinput.h
> index ab57b4c..287f440 100644
> --- a/src/libinput.h
> +++ b/src/libinput.h
> @@ -1351,7 +1351,8 @@ libinput_event_tablet_tool_get_base_event(struct libinput_event_tablet_tool *eve
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1371,7 +1372,8 @@ libinput_event_tablet_tool_x_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1391,7 +1393,8 @@ libinput_event_tablet_tool_y_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1413,7 +1416,8 @@ libinput_event_tablet_tool_pressure_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1433,7 +1437,8 @@ libinput_event_tablet_tool_distance_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1453,7 +1458,8 @@ libinput_event_tablet_tool_tilt_x_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1472,7 +1478,8 @@ libinput_event_tablet_tool_tilt_y_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1491,7 +1498,8 @@ libinput_event_tablet_tool_rotation_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> @@ -1510,7 +1518,8 @@ libinput_event_tablet_tool_slider_has_changed(
> * @note It is an application bug to call this function for events other
> * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref
> * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref
> - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY.
> + * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref
> + * LIBINPUT_EVENT_TABLET_TOOL_BUTTON.
> *
> * @param event The libinput tablet event
> * @return 1 if the axis was updated or 0 otherwise
> --
> 2.5.0
>
More information about the wayland-devel
mailing list