[PATCH libinput 05/14] tablet: rename TOOL_TYPE to TABLET_TOOL_TYPE

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 17 20:17:52 PST 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-tablet.c  | 54 ++++++++++++++++++++++++++---------------------------
 src/evdev-tablet.h  | 18 +++++++++---------
 src/libinput.h      | 26 +++++++++++++-------------
 test/tablet.c       |  8 ++++----
 tools/event-debug.c | 16 ++++++++--------
 5 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 1afc044..3dfc005 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_TOOL_AXIS_ROTATION_Z &&
-		   (tablet->current_tool_type == LIBINPUT_TOOL_TYPE_MOUSE ||
-		    tablet->current_tool_type == LIBINPUT_TOOL_TYPE_LENS)) {
+		   (tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE ||
+		    tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_LENS)) {
 			convert_tilt_to_rotation(tablet);
 			axes[LIBINPUT_TABLET_TOOL_AXIS_TILT_X] = 0;
 			axes[LIBINPUT_TABLET_TOOL_AXIS_TILT_Y] = 0;
@@ -466,14 +466,14 @@ tablet_evcode_to_tool(int code)
 	enum libinput_tablet_tool_type type;
 
 	switch (code) {
-	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;
+	case BTN_TOOL_PEN:	type = LIBINPUT_TABLET_TOOL_TYPE_PEN;		break;
+	case BTN_TOOL_RUBBER:	type = LIBINPUT_TABLET_TOOL_TYPE_ERASER;	break;
+	case BTN_TOOL_BRUSH:	type = LIBINPUT_TABLET_TOOL_TYPE_BRUSH;	break;
+	case BTN_TOOL_PENCIL:	type = LIBINPUT_TABLET_TOOL_TYPE_PENCIL;	break;
+	case BTN_TOOL_AIRBRUSH:	type = LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH;	break;
+	case BTN_TOOL_FINGER:	type = LIBINPUT_TABLET_TOOL_TYPE_FINGER;	break;
+	case BTN_TOOL_MOUSE:	type = LIBINPUT_TABLET_TOOL_TYPE_MOUSE;	break;
+	case BTN_TOOL_LENS:	type = LIBINPUT_TABLET_TOOL_TYPE_LENS;		break;
 	default:
 		abort();
 	}
@@ -681,11 +681,11 @@ tool_set_bits(const struct tablet_dispatch *tablet,
 	   anyway.
 	 */
 	switch (type) {
-	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:
+	case LIBINPUT_TABLET_TOOL_TYPE_PEN:
+	case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
+	case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
+	case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
+	case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
 		copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE);
 		copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE);
 		copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_X);
@@ -693,8 +693,8 @@ tool_set_bits(const struct tablet_dispatch *tablet,
 		copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_SLIDER);
 		copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
 		break;
-	case LIBINPUT_TOOL_TYPE_MOUSE:
-	case LIBINPUT_TOOL_TYPE_LENS:
+	case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
+	case LIBINPUT_TABLET_TOOL_TYPE_LENS:
 		copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
 		copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL);
 		break;
@@ -705,16 +705,16 @@ 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_TYPE_PEN:
-	case LIBINPUT_TOOL_TYPE_BRUSH:
-	case LIBINPUT_TOOL_TYPE_AIRBRUSH:
-	case LIBINPUT_TOOL_TYPE_PENCIL:
-	case LIBINPUT_TOOL_TYPE_ERASER:
+	case LIBINPUT_TABLET_TOOL_TYPE_PEN:
+	case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
+	case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
+	case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
+	case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
 		copy_button_cap(tablet, tool, BTN_STYLUS);
 		copy_button_cap(tablet, tool, BTN_STYLUS2);
 		break;
-	case LIBINPUT_TOOL_TYPE_MOUSE:
-	case LIBINPUT_TOOL_TYPE_LENS:
+	case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
+	case LIBINPUT_TABLET_TOOL_TYPE_LENS:
 		copy_button_cap(tablet, tool, BTN_LEFT);
 		copy_button_cap(tablet, tool, BTN_MIDDLE);
 		copy_button_cap(tablet, tool, BTN_RIGHT);
@@ -864,8 +864,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_TYPE_MOUSE ||
-	    tablet->current_tool_type == LIBINPUT_TOOL_TYPE_LENS) &&
+	if ((tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE ||
+	    tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_LENS) &&
 	    (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_X) ||
 	     bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_Y)))
 		set_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
@@ -1023,7 +1023,7 @@ tablet_check_initial_proximity(struct evdev_device *device,
 	enum libinput_tablet_tool_type tool;
 	struct tablet_dispatch *tablet = (struct tablet_dispatch*)dispatch;
 
-	for (tool = LIBINPUT_TOOL_TYPE_PEN; tool <= LIBINPUT_TOOL_TYPE_MAX; tool++) {
+	for (tool = LIBINPUT_TABLET_TOOL_TYPE_PEN; tool <= LIBINPUT_TABLET_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 fb5ddb7..aafeda9 100644
--- a/src/evdev-tablet.h
+++ b/src/evdev-tablet.h
@@ -28,7 +28,7 @@
 
 #define LIBINPUT_TABLET_TOOL_AXIS_NONE 0
 #define LIBINPUT_TOOL_NONE 0
-#define LIBINPUT_TOOL_TYPE_MAX LIBINPUT_TOOL_TYPE_LENS
+#define LIBINPUT_TABLET_TOOL_TYPE_MAX LIBINPUT_TABLET_TOOL_TYPE_LENS
 
 enum tablet_status {
 	TABLET_NONE = 0,
@@ -165,14 +165,14 @@ tablet_tool_to_evcode(enum libinput_tablet_tool_type type)
 	int code;
 
 	switch (type) {
-	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;
+	case LIBINPUT_TABLET_TOOL_TYPE_PEN:	  code = BTN_TOOL_PEN;		break;
+	case LIBINPUT_TABLET_TOOL_TYPE_ERASER:	  code = BTN_TOOL_RUBBER;	break;
+	case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:	  code = BTN_TOOL_BRUSH;	break;
+	case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:	  code = BTN_TOOL_PENCIL;	break;
+	case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH: code = BTN_TOOL_AIRBRUSH;	break;
+	case LIBINPUT_TABLET_TOOL_TYPE_FINGER:	  code = BTN_TOOL_FINGER;	break;
+	case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:	  code = BTN_TOOL_MOUSE;	break;
+	case LIBINPUT_TABLET_TOOL_TYPE_LENS:	  code = BTN_TOOL_LENS;		break;
 	default:
 		abort();
 	}
diff --git a/src/libinput.h b/src/libinput.h
index 07b0741..b83a6fc 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -173,7 +173,7 @@ struct libinput_tablet_tool;
  * 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_TYPE_PEN.
+ * LIBINPUT_TABLET_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
@@ -183,18 +183,18 @@ struct libinput_tablet_tool;
  * @note The @ref libinput_tablet_tool_type can only describe the default physical
  * type of the device. For devices with adjustible physical properties
  * the tool type remains the same, i.e. putting a Wacom stroke nib into a
- * classic pen leaves the tool type as @ref LIBINPUT_TOOL_TYPE_PEN.
+ * classic pen leaves the tool type as @ref LIBINPUT_TABLET_TOOL_TYPE_PEN.
  */
 enum libinput_tablet_tool_type {
-	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_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 */
+	LIBINPUT_TABLET_TOOL_TYPE_PEN = 1,	/**< A generic pen */
+	LIBINPUT_TABLET_TOOL_TYPE_ERASER,	/**< Eraser */
+	LIBINPUT_TABLET_TOOL_TYPE_BRUSH,	/**< A paintbrush-like tool */
+	LIBINPUT_TABLET_TOOL_TYPE_PENCIL,	/**< Physical drawing tool, e.g.
+					             Wacom Inking Pen */
+	LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH,	/**< An airbrush-like tool */
+	LIBINPUT_TABLET_TOOL_TYPE_FINGER,	/**< Touch */
+	LIBINPUT_TABLET_TOOL_TYPE_MOUSE,	/**< A mouse bound to the tablet */
+	LIBINPUT_TABLET_TOOL_TYPE_LENS,		/**< A mouse tool with a lens */
 };
 
 /**
@@ -1392,9 +1392,9 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event,
  *   tool
  * - @ref LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z - The z rotation of the tool in
  *   degrees, clockwise from the tool's logical neutral position. For the
- *   @ref LIBINPUT_TOOL_TYPE_MOUSE and @ref LIBINPUT_TOOL_TYPE_LENS tools
+ *   @ref LIBINPUT_TABLET_TOOL_TYPE_MOUSE and @ref LIBINPUT_TABLET_TOOL_TYPE_LENS tools
  *   the logical neutral position is pointing to the current logical north
- *   of the tablet. For the @ref LIBINPUT_TOOL_TYPE_BRUSH tool, the logical
+ *   of the tablet. For the @ref LIBINPUT_TABLET_TOOL_TYPE_BRUSH tool, the logical
  *   neutral position is with the buttons pointing up.
  * - @ref LIBINPUT_TABLET_TOOL_AXIS_SLIDER - A slider on the tool, normalized
  *   from 0 to 1. e.g. the wheel-like tool on the Wacom Airbrush.
diff --git a/test/tablet.c b/test/tablet.c
index 71fca96..0e77a20 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -593,7 +593,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_TYPE_PEN);
+					 LIBINPUT_TABLET_TOOL_TYPE_PEN);
 		}
 		libinput_event_destroy(event);
 	}
@@ -1852,7 +1852,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_TYPE_MOUSE);
+			 LIBINPUT_TABLET_TOOL_TYPE_MOUSE);
 
 	libinput_event_destroy(event);
 }
@@ -2121,7 +2121,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_TYPE_AIRBRUSH);
+			 LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH);
 
 	libinput_event_destroy(event);
 }
@@ -2208,7 +2208,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_TYPE_PEN);
+			 LIBINPUT_TABLET_TOOL_TYPE_PEN);
 	ck_assert(libinput_tool_has_axis(tool,
 					 LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z));
 
diff --git a/tools/event-debug.c b/tools/event-debug.c
index 6196910..e4fe9ab 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -463,28 +463,28 @@ print_proximity_event(struct libinput_event *ev)
 	           *state_str;
 
 	switch (libinput_tool_get_type(tool)) {
-	case LIBINPUT_TOOL_TYPE_PEN:
+	case LIBINPUT_TABLET_TOOL_TYPE_PEN:
 		tool_str = "pen";
 		break;
-	case LIBINPUT_TOOL_TYPE_ERASER:
+	case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
 		tool_str = "eraser";
 		break;
-	case LIBINPUT_TOOL_TYPE_BRUSH:
+	case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
 		tool_str = "brush";
 		break;
-	case LIBINPUT_TOOL_TYPE_PENCIL:
+	case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
 		tool_str = "pencil";
 		break;
-	case LIBINPUT_TOOL_TYPE_AIRBRUSH:
+	case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
 		tool_str = "airbrush";
 		break;
-	case LIBINPUT_TOOL_TYPE_FINGER:
+	case LIBINPUT_TABLET_TOOL_TYPE_FINGER:
 		tool_str = "finger";
 		break;
-	case LIBINPUT_TOOL_TYPE_MOUSE:
+	case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
 		tool_str = "mouse";
 		break;
-	case LIBINPUT_TOOL_TYPE_LENS:
+	case LIBINPUT_TABLET_TOOL_TYPE_LENS:
 		tool_str = "lens";
 		break;
 	default:
-- 
2.5.0



More information about the wayland-devel mailing list