[PATCH libinput 6/6] tablet: rename all tool types to LIBINPUT_TOOL_TYPE_*
Jason Gerecke
killertofu at gmail.com
Fri Nov 6 15:14:22 PST 2015
On Thu, Nov 5, 2015 at 8:55 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
The weston patches are going to have to be modified to work with this
API change, but otherwise...
For the series:
Reviewed-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/evdev-tablet.c | 54 ++++++++++++++++++++++++++---------------------------
> src/evdev-tablet.h | 18 +++++++++---------
> src/libinput.h | 27 ++++++++++++++-------------
> test/tablet.c | 8 ++++----
> tools/event-debug.c | 16 ++++++++--------
> 5 files changed, 62 insertions(+), 61 deletions(-)
>
> diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
> index 851d49d..04cd082 100644
> --- a/src/evdev-tablet.c
> +++ b/src/evdev-tablet.c
> @@ -341,8 +341,8 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
> /* ROTATION_Z is higher than TILT_X/Y so we know that the
> tilt axes are already normalized and set */
> if (a == LIBINPUT_TABLET_AXIS_ROTATION_Z &&
> - (tablet->current_tool_type == LIBINPUT_TOOL_MOUSE ||
> - tablet->current_tool_type == LIBINPUT_TOOL_LENS)) {
> + (tablet->current_tool_type == LIBINPUT_TOOL_TYPE_MOUSE ||
> + tablet->current_tool_type == LIBINPUT_TOOL_TYPE_LENS)) {
> convert_tilt_to_rotation(tablet);
> axes[LIBINPUT_TABLET_AXIS_TILT_X] = 0;
> axes[LIBINPUT_TABLET_AXIS_TILT_Y] = 0;
> @@ -459,14 +459,14 @@ tablet_evcode_to_tool(int code)
> enum libinput_tool_type type;
>
> switch (code) {
> - case BTN_TOOL_PEN: type = LIBINPUT_TOOL_PEN; break;
> - case BTN_TOOL_RUBBER: type = LIBINPUT_TOOL_ERASER; break;
> - case BTN_TOOL_BRUSH: type = LIBINPUT_TOOL_BRUSH; break;
> - case BTN_TOOL_PENCIL: type = LIBINPUT_TOOL_PENCIL; break;
> - case BTN_TOOL_AIRBRUSH: type = LIBINPUT_TOOL_AIRBRUSH; break;
> - case BTN_TOOL_FINGER: type = LIBINPUT_TOOL_FINGER; break;
> - case BTN_TOOL_MOUSE: type = LIBINPUT_TOOL_MOUSE; break;
> - case BTN_TOOL_LENS: type = LIBINPUT_TOOL_LENS; break;
> + case BTN_TOOL_PEN: type = LIBINPUT_TOOL_TYPE_PEN; break;
> + case BTN_TOOL_RUBBER: type = LIBINPUT_TOOL_TYPE_ERASER; break;
> + case BTN_TOOL_BRUSH: type = LIBINPUT_TOOL_TYPE_BRUSH; break;
> + case BTN_TOOL_PENCIL: type = LIBINPUT_TOOL_TYPE_PENCIL; break;
> + case BTN_TOOL_AIRBRUSH: type = LIBINPUT_TOOL_TYPE_AIRBRUSH; break;
> + case BTN_TOOL_FINGER: type = LIBINPUT_TOOL_TYPE_FINGER; break;
> + case BTN_TOOL_MOUSE: type = LIBINPUT_TOOL_TYPE_MOUSE; break;
> + case BTN_TOOL_LENS: type = LIBINPUT_TOOL_TYPE_LENS; break;
> default:
> abort();
> }
> @@ -676,11 +676,11 @@ tool_set_bits(const struct tablet_dispatch *tablet,
> anyway.
> */
> switch (type) {
> - case LIBINPUT_TOOL_PEN:
> - case LIBINPUT_TOOL_ERASER:
> - case LIBINPUT_TOOL_PENCIL:
> - case LIBINPUT_TOOL_BRUSH:
> - case LIBINPUT_TOOL_AIRBRUSH:
> + case LIBINPUT_TOOL_TYPE_PEN:
> + case LIBINPUT_TOOL_TYPE_ERASER:
> + case LIBINPUT_TOOL_TYPE_PENCIL:
> + case LIBINPUT_TOOL_TYPE_BRUSH:
> + case LIBINPUT_TOOL_TYPE_AIRBRUSH:
> copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_PRESSURE);
> copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_DISTANCE);
> copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_TILT_X);
> @@ -688,8 +688,8 @@ tool_set_bits(const struct tablet_dispatch *tablet,
> copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_SLIDER);
> copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_ROTATION_Z);
> break;
> - case LIBINPUT_TOOL_MOUSE:
> - case LIBINPUT_TOOL_LENS:
> + case LIBINPUT_TOOL_TYPE_MOUSE:
> + case LIBINPUT_TOOL_TYPE_LENS:
> copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_ROTATION_Z);
> copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_REL_WHEEL);
> break;
> @@ -700,17 +700,17 @@ tool_set_bits(const struct tablet_dispatch *tablet,
> /* If we don't have libwacom, copy all pen-related ones from the
> tablet vs all mouse-related ones */
> switch (type) {
> - case LIBINPUT_TOOL_PEN:
> - case LIBINPUT_TOOL_BRUSH:
> - case LIBINPUT_TOOL_AIRBRUSH:
> - case LIBINPUT_TOOL_PENCIL:
> - case LIBINPUT_TOOL_ERASER:
> + case LIBINPUT_TOOL_TYPE_PEN:
> + case LIBINPUT_TOOL_TYPE_BRUSH:
> + case LIBINPUT_TOOL_TYPE_AIRBRUSH:
> + case LIBINPUT_TOOL_TYPE_PENCIL:
> + case LIBINPUT_TOOL_TYPE_ERASER:
> copy_button_cap(tablet, tool, BTN_STYLUS);
> copy_button_cap(tablet, tool, BTN_STYLUS2);
> copy_button_cap(tablet, tool, BTN_TOUCH);
> break;
> - case LIBINPUT_TOOL_MOUSE:
> - case LIBINPUT_TOOL_LENS:
> + case LIBINPUT_TOOL_TYPE_MOUSE:
> + case LIBINPUT_TOOL_TYPE_LENS:
> copy_button_cap(tablet, tool, BTN_LEFT);
> copy_button_cap(tablet, tool, BTN_MIDDLE);
> copy_button_cap(tablet, tool, BTN_RIGHT);
> @@ -854,8 +854,8 @@ sanitize_tablet_axes(struct tablet_dispatch *tablet)
>
> /* If we have a mouse/lens cursor and the tilt changed, the rotation
> changed. Mark this, calculate the angle later */
> - if ((tablet->current_tool_type == LIBINPUT_TOOL_MOUSE ||
> - tablet->current_tool_type == LIBINPUT_TOOL_LENS) &&
> + if ((tablet->current_tool_type == LIBINPUT_TOOL_TYPE_MOUSE ||
> + tablet->current_tool_type == LIBINPUT_TOOL_TYPE_LENS) &&
> (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_AXIS_TILT_X) ||
> bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_AXIS_TILT_Y)))
> set_bit(tablet->changed_axes, LIBINPUT_TABLET_AXIS_ROTATION_Z);
> @@ -991,7 +991,7 @@ tablet_check_initial_proximity(struct evdev_device *device,
> enum libinput_tool_type tool;
> struct tablet_dispatch *tablet = (struct tablet_dispatch*)dispatch;
>
> - for (tool = LIBINPUT_TOOL_PEN; tool <= LIBINPUT_TOOL_MAX; tool++) {
> + for (tool = LIBINPUT_TOOL_TYPE_PEN; tool <= LIBINPUT_TOOL_TYPE_MAX; tool++) {
> code = tablet_tool_to_evcode(tool);
>
> /* we only expect one tool to be in proximity at a time */
> diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h
> index 2ba08fa..6b80142 100644
> --- a/src/evdev-tablet.h
> +++ b/src/evdev-tablet.h
> @@ -28,7 +28,7 @@
>
> #define LIBINPUT_TABLET_AXIS_NONE 0
> #define LIBINPUT_TOOL_NONE 0
> -#define LIBINPUT_TOOL_MAX LIBINPUT_TOOL_LENS
> +#define LIBINPUT_TOOL_TYPE_MAX LIBINPUT_TOOL_TYPE_LENS
>
> enum tablet_status {
> TABLET_NONE = 0,
> @@ -163,14 +163,14 @@ tablet_tool_to_evcode(enum libinput_tool_type type)
> int code;
>
> switch (type) {
> - case LIBINPUT_TOOL_PEN: code = BTN_TOOL_PEN; break;
> - case LIBINPUT_TOOL_ERASER: code = BTN_TOOL_RUBBER; break;
> - case LIBINPUT_TOOL_BRUSH: code = BTN_TOOL_BRUSH; break;
> - case LIBINPUT_TOOL_PENCIL: code = BTN_TOOL_PENCIL; break;
> - case LIBINPUT_TOOL_AIRBRUSH: code = BTN_TOOL_AIRBRUSH; break;
> - case LIBINPUT_TOOL_FINGER: code = BTN_TOOL_FINGER; break;
> - case LIBINPUT_TOOL_MOUSE: code = BTN_TOOL_MOUSE; break;
> - case LIBINPUT_TOOL_LENS: code = BTN_TOOL_LENS; break;
> + case LIBINPUT_TOOL_TYPE_PEN: code = BTN_TOOL_PEN; break;
> + case LIBINPUT_TOOL_TYPE_ERASER: code = BTN_TOOL_RUBBER; break;
> + case LIBINPUT_TOOL_TYPE_BRUSH: code = BTN_TOOL_BRUSH; break;
> + case LIBINPUT_TOOL_TYPE_PENCIL: code = BTN_TOOL_PENCIL; break;
> + case LIBINPUT_TOOL_TYPE_AIRBRUSH: code = BTN_TOOL_AIRBRUSH; break;
> + case LIBINPUT_TOOL_TYPE_FINGER: code = BTN_TOOL_FINGER; break;
> + case LIBINPUT_TOOL_TYPE_MOUSE: code = BTN_TOOL_MOUSE; break;
> + case LIBINPUT_TOOL_TYPE_LENS: code = BTN_TOOL_LENS; break;
> default:
> abort();
> }
> diff --git a/src/libinput.h b/src/libinput.h
> index 3b797a4..9c3bdd4 100644
> --- a/src/libinput.h
> +++ b/src/libinput.h
> @@ -172,7 +172,8 @@ struct libinput_tool;
> * LIBINPUT_DEVICE_CAP_TABLET capability. The tool type defines the default
> * usage of the tool as advertised by the manufacturer. Multiple different
> * physical tools may share the same tool type, e.g. a Wacom Classic Pen,
> - * Wacom Pro Pen and a Wacom Grip Pen are all of type @ref LIBINPUT_TOOL_PEN.
> + * Wacom Pro Pen and a Wacom Grip Pen are all of type @ref
> + * LIBINPUT_TOOL_TYPE_PEN.
> * Use libinput_tool_get_tool_id() to get a specific model where applicable.
> *
> * Note that on some device, the eraser tool is on the tail end of a pen
> @@ -185,15 +186,15 @@ struct libinput_tool;
> * classic pen leaves the tool type as @ref LIBINPUT_TOOL_PEN.
> */
> enum libinput_tool_type {
> - LIBINPUT_TOOL_PEN = 1, /**< A generic pen */
> - LIBINPUT_TOOL_ERASER, /**< Eraser */
> - LIBINPUT_TOOL_BRUSH, /**< A paintbrush-like tool */
> - LIBINPUT_TOOL_PENCIL, /**< Physical drawing tool, e.g.
> + LIBINPUT_TOOL_TYPE_PEN = 1, /**< A generic pen */
> + LIBINPUT_TOOL_TYPE_ERASER, /**< Eraser */
> + LIBINPUT_TOOL_TYPE_BRUSH, /**< A paintbrush-like tool */
> + LIBINPUT_TOOL_TYPE_PENCIL, /**< Physical drawing tool, e.g.
> Wacom Inking Pen */
> - LIBINPUT_TOOL_AIRBRUSH, /**< An airbrush-like tool */
> - LIBINPUT_TOOL_FINGER, /**< Touch */
> - LIBINPUT_TOOL_MOUSE, /**< A mouse bound to the tablet */
> - LIBINPUT_TOOL_LENS, /**< A mouse tool with a lens */
> + LIBINPUT_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */
> + LIBINPUT_TOOL_TYPE_FINGER, /**< Touch */
> + LIBINPUT_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */
> + LIBINPUT_TOOL_TYPE_LENS, /**< A mouse tool with a lens */
> };
>
> /**
> @@ -1357,10 +1358,10 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event,
> * tool
> * - @ref LIBINPUT_TABLET_AXIS_ROTATION_Z - The z rotation of the tool in
> * degrees, clockwise from the tool's logical neutral position. For the
> - * @ref LIBINPUT_TOOL_MOUSE and @ref LIBINPUT_TOOL_LENS tools the logical
> - * neutral position is pointing to the current logical north of the
> - * tablet. For the @ref LIBINPUT_TOOL_BRUSH tool, the logical neutral
> - * position is with the buttons pointing up.
> + * @ref LIBINPUT_TOOL_TYPE_MOUSE and @ref LIBINPUT_TOOL_TYPE_LENS tools
> + * the logical neutral position is pointing to the current logical north
> + * of the tablet. For the @ref LIBINPUT_TOOL_BRUSH tool, the logical
> + * neutral position is with the buttons pointing up.
> * - @ref LIBINPUT_TABLET_AXIS_SLIDER - A slider on the tool, normalized
> * from 0 to 1. e.g. the wheel-like tool on the Wacom Airbrush.
> * - @ref LIBINPUT_TABLET_AXIS_REL_WHEEL - A relative wheel on the tool,
> diff --git a/test/tablet.c b/test/tablet.c
> index d82c650..8048c70 100644
> --- a/test/tablet.c
> +++ b/test/tablet.c
> @@ -62,7 +62,7 @@ START_TEST(proximity_in_out)
> tablet_event = libinput_event_get_tablet_event(event);
> tool = libinput_event_tablet_get_tool(tablet_event);
> ck_assert_int_eq(libinput_tool_get_type(tool),
> - LIBINPUT_TOOL_PEN);
> + LIBINPUT_TOOL_TYPE_PEN);
> }
> libinput_event_destroy(event);
> }
> @@ -1289,7 +1289,7 @@ START_TEST(mouse_tool)
> tool = libinput_event_tablet_get_tool(tev);
> ck_assert_notnull(tool);
> ck_assert_int_eq(libinput_tool_get_type(tool),
> - LIBINPUT_TOOL_MOUSE);
> + LIBINPUT_TOOL_TYPE_MOUSE);
>
> libinput_event_destroy(event);
> }
> @@ -1558,7 +1558,7 @@ START_TEST(airbrush_tool)
> tool = libinput_event_tablet_get_tool(tev);
> ck_assert_notnull(tool);
> ck_assert_int_eq(libinput_tool_get_type(tool),
> - LIBINPUT_TOOL_AIRBRUSH);
> + LIBINPUT_TOOL_TYPE_AIRBRUSH);
>
> libinput_event_destroy(event);
> }
> @@ -1645,7 +1645,7 @@ START_TEST(artpen_tool)
> tool = libinput_event_tablet_get_tool(tev);
> ck_assert_notnull(tool);
> ck_assert_int_eq(libinput_tool_get_type(tool),
> - LIBINPUT_TOOL_PEN);
> + LIBINPUT_TOOL_TYPE_PEN);
> ck_assert(libinput_tool_has_axis(tool,
> LIBINPUT_TABLET_AXIS_ROTATION_Z));
>
> diff --git a/tools/event-debug.c b/tools/event-debug.c
> index 29c0e56..6e5f8a8 100644
> --- a/tools/event-debug.c
> +++ b/tools/event-debug.c
> @@ -448,28 +448,28 @@ print_proximity_event(struct libinput_event *ev)
> *state_str;
>
> switch (libinput_tool_get_type(tool)) {
> - case LIBINPUT_TOOL_PEN:
> + case LIBINPUT_TOOL_TYPE_PEN:
> tool_str = "pen";
> break;
> - case LIBINPUT_TOOL_ERASER:
> + case LIBINPUT_TOOL_TYPE_ERASER:
> tool_str = "eraser";
> break;
> - case LIBINPUT_TOOL_BRUSH:
> + case LIBINPUT_TOOL_TYPE_BRUSH:
> tool_str = "brush";
> break;
> - case LIBINPUT_TOOL_PENCIL:
> + case LIBINPUT_TOOL_TYPE_PENCIL:
> tool_str = "pencil";
> break;
> - case LIBINPUT_TOOL_AIRBRUSH:
> + case LIBINPUT_TOOL_TYPE_AIRBRUSH:
> tool_str = "airbrush";
> break;
> - case LIBINPUT_TOOL_FINGER:
> + case LIBINPUT_TOOL_TYPE_FINGER:
> tool_str = "finger";
> break;
> - case LIBINPUT_TOOL_MOUSE:
> + case LIBINPUT_TOOL_TYPE_MOUSE:
> tool_str = "mouse";
> break;
> - case LIBINPUT_TOOL_LENS:
> + case LIBINPUT_TOOL_TYPE_LENS:
> tool_str = "lens";
> break;
> default:
> --
> 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