[PATCH libinput 01/14] tablet: rename libinput_tool to libinput_tablet_tool

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


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-tablet.c     | 24 ++++++++++++------------
 src/libinput-private.h | 10 +++++-----
 src/libinput.c         | 36 ++++++++++++++++++------------------
 src/libinput.h         | 26 +++++++++++++-------------
 test/tablet.c          | 28 ++++++++++++++--------------
 tools/event-debug.c    |  4 ++--
 6 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index ed64d55..7537e21 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -317,7 +317,7 @@ static void
 tablet_check_notify_axes(struct tablet_dispatch *tablet,
 			 struct evdev_device *device,
 			 uint64_t time,
-			 struct libinput_tool *tool)
+			 struct libinput_tablet_tool *tool)
 {
 	struct libinput_device *base = &device->base;
 	bool axis_update_needed = false;
@@ -576,7 +576,7 @@ tablet_process_misc(struct tablet_dispatch *tablet,
 
 static inline void
 copy_axis_cap(const struct tablet_dispatch *tablet,
-	      struct libinput_tool *tool,
+	      struct libinput_tablet_tool *tool,
 	      enum libinput_tablet_axis axis)
 {
 	if (bit_is_set(tablet->axis_caps, axis))
@@ -585,7 +585,7 @@ copy_axis_cap(const struct tablet_dispatch *tablet,
 
 static inline void
 copy_button_cap(const struct tablet_dispatch *tablet,
-		struct libinput_tool *tool,
+		struct libinput_tablet_tool *tool,
 		uint32_t button)
 {
 	struct libevdev *evdev = tablet->device->evdev;
@@ -595,7 +595,7 @@ copy_button_cap(const struct tablet_dispatch *tablet,
 
 static inline int
 tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet,
-			    struct libinput_tool *tool)
+			    struct libinput_tablet_tool *tool)
 {
 	int rc = 1;
 
@@ -668,7 +668,7 @@ out:
 
 static void
 tool_set_bits(const struct tablet_dispatch *tablet,
-	      struct libinput_tool *tool)
+	      struct libinput_tablet_tool *tool)
 {
 	enum libinput_tool_type type = tool->type;
 
@@ -726,13 +726,13 @@ tool_set_bits(const struct tablet_dispatch *tablet,
 	}
 }
 
-static struct libinput_tool *
+static struct libinput_tablet_tool *
 tablet_get_tool(struct tablet_dispatch *tablet,
 		enum libinput_tool_type type,
 		uint32_t tool_id,
 		uint32_t serial)
 {
-	struct libinput_tool *tool = NULL, *t;
+	struct libinput_tablet_tool *tool = NULL, *t;
 	struct list *tool_list;
 
 	if (serial) {
@@ -765,7 +765,7 @@ tablet_get_tool(struct tablet_dispatch *tablet,
 	 * add it */
 	if (!tool) {
 		tool = zalloc(sizeof *tool);
-		*tool = (struct libinput_tool) {
+		*tool = (struct libinput_tablet_tool) {
 			.type = type,
 			.serial = serial,
 			.tool_id = tool_id,
@@ -784,7 +784,7 @@ static void
 tablet_notify_button_mask(struct tablet_dispatch *tablet,
 			  struct evdev_device *device,
 			  uint64_t time,
-			  struct libinput_tool *tool,
+			  struct libinput_tablet_tool *tool,
 			  const unsigned char *buttons,
 			  unsigned int buttons_len,
 			  enum libinput_button_state state)
@@ -815,7 +815,7 @@ static void
 tablet_notify_buttons(struct tablet_dispatch *tablet,
 		      struct evdev_device *device,
 		      uint64_t time,
-		      struct libinput_tool *tool,
+		      struct libinput_tablet_tool *tool,
 		      enum libinput_button_state state)
 {
 	unsigned char buttons[ARRAY_LENGTH(tablet->button_state.stylus_buttons)];
@@ -876,7 +876,7 @@ tablet_flush(struct tablet_dispatch *tablet,
 	     struct evdev_device *device,
 	     uint64_t time)
 {
-	struct libinput_tool *tool =
+	struct libinput_tablet_tool *tool =
 		tablet_get_tool(tablet,
 				tablet->current_tool_type,
 				tablet->current_tool_id,
@@ -1005,7 +1005,7 @@ tablet_destroy(struct evdev_dispatch *dispatch)
 {
 	struct tablet_dispatch *tablet =
 		(struct tablet_dispatch*)dispatch;
-	struct libinput_tool *tool, *tmp;
+	struct libinput_tablet_tool *tool, *tmp;
 
 	list_for_each_safe(tool, tmp, &tablet->tool_list, link) {
 		libinput_tool_unref(tool);
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 702bf6e..b28e0e1 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -250,7 +250,7 @@ struct libinput_device {
 	struct libinput_device_config config;
 };
 
-struct libinput_tool {
+struct libinput_tablet_tool {
 	struct list link;
 	uint32_t serial;
 	uint32_t tool_id;
@@ -462,7 +462,7 @@ touch_notify_frame(struct libinput_device *device,
 void
 tablet_notify_axis(struct libinput_device *device,
 		   uint64_t time,
-		   struct libinput_tool *tool,
+		   struct libinput_tablet_tool *tool,
 		   enum libinput_tool_tip_state tip_state,
 		   unsigned char *changed_axes,
 		   double *axes,
@@ -472,7 +472,7 @@ tablet_notify_axis(struct libinput_device *device,
 void
 tablet_notify_proximity(struct libinput_device *device,
 			uint64_t time,
-			struct libinput_tool *tool,
+			struct libinput_tablet_tool *tool,
 			enum libinput_tool_proximity_state state,
 			unsigned char *changed_axes,
 			double *axes);
@@ -480,14 +480,14 @@ tablet_notify_proximity(struct libinput_device *device,
 void
 tablet_notify_tip(struct libinput_device *device,
 		  uint64_t time,
-		  struct libinput_tool *tool,
+		  struct libinput_tablet_tool *tool,
 		  enum libinput_tool_tip_state tip_state,
 		  double *axes);
 
 void
 tablet_notify_button(struct libinput_device *device,
 		     uint64_t time,
-		     struct libinput_tool *tool,
+		     struct libinput_tablet_tool *tool,
 		     enum libinput_tool_tip_state tip_state,
 		     double *axes,
 		     int32_t button,
diff --git a/src/libinput.c b/src/libinput.c
index 479418e..b50f533 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -135,7 +135,7 @@ struct libinput_event_tablet {
 	double deltas[LIBINPUT_TABLET_AXIS_MAX + 1];
 	double deltas_discrete[LIBINPUT_TABLET_AXIS_MAX + 1];
 	unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_AXIS_MAX + 1)];
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 	enum libinput_tool_proximity_state proximity_state;
 	enum libinput_tool_tip_state tip_state;
 };
@@ -1061,7 +1061,7 @@ libinput_event_tablet_get_y_transformed(struct libinput_event_tablet *event,
 					height);
 }
 
-LIBINPUT_EXPORT struct libinput_tool *
+LIBINPUT_EXPORT struct libinput_tablet_tool *
 libinput_event_tablet_get_tool(struct libinput_event_tablet *event)
 {
 	require_event_type(libinput_event_get_context(&event->base),
@@ -1165,32 +1165,32 @@ libinput_event_tablet_get_seat_button_count(struct libinput_event_tablet *event)
 }
 
 LIBINPUT_EXPORT enum libinput_tool_type
-libinput_tool_get_type(struct libinput_tool *tool)
+libinput_tool_get_type(struct libinput_tablet_tool *tool)
 {
 	return tool->type;
 }
 
 LIBINPUT_EXPORT uint64_t
-libinput_tool_get_tool_id(struct libinput_tool *tool)
+libinput_tool_get_tool_id(struct libinput_tablet_tool *tool)
 {
 	return tool->tool_id;
 }
 
 LIBINPUT_EXPORT uint64_t
-libinput_tool_get_serial(struct libinput_tool *tool)
+libinput_tool_get_serial(struct libinput_tablet_tool *tool)
 {
 	return tool->serial;
 }
 
 LIBINPUT_EXPORT int
-libinput_tool_has_axis(struct libinput_tool *tool,
+libinput_tool_has_axis(struct libinput_tablet_tool *tool,
 		       enum libinput_tablet_axis axis)
 {
 	return bit_is_set(tool->axis_caps, axis);
 }
 
 LIBINPUT_EXPORT int
-libinput_tool_has_button(struct libinput_tool *tool,
+libinput_tool_has_button(struct libinput_tablet_tool *tool,
 			 uint32_t code)
 {
 	if (NCHARS(code) > sizeof(tool->buttons))
@@ -1200,27 +1200,27 @@ libinput_tool_has_button(struct libinput_tool *tool,
 }
 
 LIBINPUT_EXPORT void
-libinput_tool_set_user_data(struct libinput_tool *tool,
+libinput_tool_set_user_data(struct libinput_tablet_tool *tool,
 			    void *user_data)
 {
 	tool->user_data = user_data;
 }
 
 LIBINPUT_EXPORT void *
-libinput_tool_get_user_data(struct libinput_tool *tool)
+libinput_tool_get_user_data(struct libinput_tablet_tool *tool)
 {
 	return tool->user_data;
 }
 
-LIBINPUT_EXPORT struct libinput_tool *
-libinput_tool_ref(struct libinput_tool *tool)
+LIBINPUT_EXPORT struct libinput_tablet_tool *
+libinput_tool_ref(struct libinput_tablet_tool *tool)
 {
 	tool->refcount++;
 	return tool;
 }
 
-LIBINPUT_EXPORT struct libinput_tool *
-libinput_tool_unref(struct libinput_tool *tool)
+LIBINPUT_EXPORT struct libinput_tablet_tool *
+libinput_tool_unref(struct libinput_tablet_tool *tool)
 {
 	assert(tool->refcount > 0);
 
@@ -1337,7 +1337,7 @@ libinput_unref(struct libinput *libinput)
 	struct libinput_event *event;
 	struct libinput_device *device, *next_device;
 	struct libinput_seat *seat, *next_seat;
-	struct libinput_tool *tool, *next_tool;
+	struct libinput_tablet_tool *tool, *next_tool;
 	struct libinput_device_group *group, *next_group;
 
 	if (libinput == NULL)
@@ -1972,7 +1972,7 @@ touch_notify_frame(struct libinput_device *device,
 void
 tablet_notify_axis(struct libinput_device *device,
 		   uint64_t time,
-		   struct libinput_tool *tool,
+		   struct libinput_tablet_tool *tool,
 		   enum libinput_tool_tip_state tip_state,
 		   unsigned char *changed_axes,
 		   double *axes,
@@ -2010,7 +2010,7 @@ tablet_notify_axis(struct libinput_device *device,
 void
 tablet_notify_proximity(struct libinput_device *device,
 			uint64_t time,
-			struct libinput_tool *tool,
+			struct libinput_tablet_tool *tool,
 			enum libinput_tool_proximity_state proximity_state,
 			unsigned char *changed_axes,
 			double *axes)
@@ -2044,7 +2044,7 @@ tablet_notify_proximity(struct libinput_device *device,
 void
 tablet_notify_tip(struct libinput_device *device,
 		  uint64_t time,
-		  struct libinput_tool *tool,
+		  struct libinput_tablet_tool *tool,
 		  enum libinput_tool_tip_state tip_state,
 		  double *axes)
 {
@@ -2073,7 +2073,7 @@ tablet_notify_tip(struct libinput_device *device,
 void
 tablet_notify_button(struct libinput_device *device,
 		     uint64_t time,
-		     struct libinput_tool *tool,
+		     struct libinput_tablet_tool *tool,
 		     enum libinput_tool_tip_state tip_state,
 		     double *axes,
 		     int32_t button,
diff --git a/src/libinput.h b/src/libinput.h
index dc7e7d8..bda1f9d 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -163,7 +163,7 @@ enum libinput_tablet_axis {
  * is possible to track the same physical tool across multiple
  * struct libinput_device devices.
  */
-struct libinput_tool;
+struct libinput_tablet_tool;
 
 /**
  * @ingroup device
@@ -1508,7 +1508,7 @@ libinput_event_tablet_get_y_transformed(struct libinput_event_tablet *event,
  * @param event The libinput tablet event
  * @return The new tool triggering this event
  */
-struct libinput_tool *
+struct libinput_tablet_tool *
 libinput_event_tablet_get_tool(struct libinput_event_tablet *event);
 
 /**
@@ -1614,7 +1614,7 @@ libinput_event_tablet_get_time_usec(struct libinput_event_tablet *event);
  * @see libinput_tool_get_tool_id
  */
 enum libinput_tool_type
-libinput_tool_get_type(struct libinput_tool *tool);
+libinput_tool_get_type(struct libinput_tablet_tool *tool);
 
 /**
  * @ingroup event_tablet
@@ -1632,7 +1632,7 @@ libinput_tool_get_type(struct libinput_tool *tool);
  * @see libinput_tool_get_type
  */
 uint64_t
-libinput_tool_get_tool_id(struct libinput_tool *tool);
+libinput_tool_get_tool_id(struct libinput_tablet_tool *tool);
 
 /**
  * @ingroup event_tablet
@@ -1642,8 +1642,8 @@ libinput_tool_get_tool_id(struct libinput_tool *tool);
  * @param tool The tool to increment the ref count of
  * @return The passed tool
  */
-struct libinput_tool *
-libinput_tool_ref(struct libinput_tool *tool);
+struct libinput_tablet_tool *
+libinput_tool_ref(struct libinput_tablet_tool *tool);
 
 /**
  * @ingroup event_tablet
@@ -1655,7 +1655,7 @@ libinput_tool_ref(struct libinput_tool *tool);
  * @return Whether or not the axis is supported
  */
 int
-libinput_tool_has_axis(struct libinput_tool *tool,
+libinput_tool_has_axis(struct libinput_tablet_tool *tool,
 		       enum libinput_tablet_axis axis);
 
 /**
@@ -1670,7 +1670,7 @@ libinput_tool_has_axis(struct libinput_tool *tool,
  * @return 1 if the tool supports this button code, 0 if it does not
  */
 int
-libinput_tool_has_button(struct libinput_tool *tool,
+libinput_tool_has_button(struct libinput_tablet_tool *tool,
 		         uint32_t code);
 
 /**
@@ -1682,8 +1682,8 @@ libinput_tool_has_button(struct libinput_tool *tool,
  * @param tool The tool to decrement the ref count of
  * @return NULL if the tool was destroyed otherwise the passed tool
  */
-struct libinput_tool *
-libinput_tool_unref(struct libinput_tool *tool);
+struct libinput_tablet_tool *
+libinput_tool_unref(struct libinput_tablet_tool *tool);
 
 /**
  * @ingroup event_tablet
@@ -1698,7 +1698,7 @@ libinput_tool_unref(struct libinput_tool *tool);
  * @return The new tool serial triggering this event
  */
 uint64_t
-libinput_tool_get_serial(struct libinput_tool *tool);
+libinput_tool_get_serial(struct libinput_tablet_tool *tool);
 
 /**
  * @ingroup event_tablet
@@ -1709,7 +1709,7 @@ libinput_tool_get_serial(struct libinput_tool *tool);
  * @return The user data associated with the tool object
  */
 void *
-libinput_tool_get_user_data(struct libinput_tool *tool);
+libinput_tool_get_user_data(struct libinput_tablet_tool *tool);
 
 /**
  * @ingroup event_tablet
@@ -1720,7 +1720,7 @@ libinput_tool_get_user_data(struct libinput_tool *tool);
  * @param user_data The user data to associate with the tool object
  */
 void
-libinput_tool_set_user_data(struct libinput_tool *tool,
+libinput_tool_set_user_data(struct libinput_tablet_tool *tool,
 			    void *user_data);
 
 /**
diff --git a/test/tablet.c b/test/tablet.c
index 1bd3f13..b7ccdab 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -587,7 +587,7 @@ START_TEST(proximity_in_out)
 	while ((event = libinput_get_event(li))) {
 		if (libinput_event_get_type(event) ==
 		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
-			struct libinput_tool * tool;
+			struct libinput_tablet_tool * tool;
 
 			have_tool_update++;
 			tablet_event = libinput_event_get_tablet_event(event);
@@ -697,7 +697,7 @@ START_TEST(proximity_has_axes)
 	struct libinput *li = dev->libinput;
 	struct libinput_event_tablet *tablet_event;
 	struct libinput_event *event;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 	double x, y,
 	       distance;
 	double last_x, last_y, last_distance,
@@ -1440,7 +1440,7 @@ START_TEST(tool_serial)
 	struct libinput *li = dev->libinput;
 	struct libinput_event_tablet *tablet_event;
 	struct libinput_event *event;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	litest_drain_events(li);
 
@@ -1465,7 +1465,7 @@ START_TEST(serial_changes_tool)
 	struct libinput *li = dev->libinput;
 	struct libinput_event_tablet *tablet_event;
 	struct libinput_event *event;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	litest_drain_events(li);
 
@@ -1498,7 +1498,7 @@ START_TEST(invalid_serials)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_tablet *tablet_event;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	litest_drain_events(li);
 
@@ -1534,7 +1534,7 @@ START_TEST(tool_ref)
 	struct libinput *li = dev->libinput;
 	struct libinput_event_tablet *tablet_event;
 	struct libinput_event *event;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	litest_drain_events(li);
 
@@ -1611,7 +1611,7 @@ START_TEST(tools_with_serials)
 {
 	struct libinput *li = litest_create_context();
 	struct litest_device *dev[2];
-	struct libinput_tool *tool[2] = {0};
+	struct libinput_tablet_tool *tool[2] = {0};
 	struct libinput_event *event;
 	int i;
 
@@ -1660,7 +1660,7 @@ START_TEST(tools_without_serials)
 {
 	struct libinput *li = litest_create_context();
 	struct litest_device *dev[2];
-	struct libinput_tool *tool[2] = {0};
+	struct libinput_tablet_tool *tool[2] = {0};
 	struct libinput_event *event;
 	int i;
 
@@ -1712,7 +1712,7 @@ START_TEST(tool_capabilities)
 	struct litest_device *bamboo;
 	struct libinput_event *event;
 	struct libinput_event_tablet *t;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	/* The axis capabilities of a tool can differ depending on the type of
 	 * tablet the tool is being used with */
@@ -1831,7 +1831,7 @@ START_TEST(mouse_tool)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_tablet *tev;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	if (!libevdev_has_event_code(dev->evdev,
 				    EV_KEY,
@@ -1864,7 +1864,7 @@ START_TEST(mouse_buttons)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_tablet *tev;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 	int code;
 
 	if (!libevdev_has_event_code(dev->evdev,
@@ -2001,7 +2001,7 @@ START_TEST(mouse_wheel)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_tablet *tev;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 	const struct input_absinfo *abs;
 	double val;
 	int i;
@@ -2100,7 +2100,7 @@ START_TEST(airbrush_tool)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_tablet *tev;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	if (!libevdev_has_event_code(dev->evdev,
 				    EV_KEY,
@@ -2186,7 +2186,7 @@ START_TEST(artpen_tool)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_tablet *tev;
-	struct libinput_tool *tool;
+	struct libinput_tablet_tool *tool;
 
 	if (!libevdev_has_event_code(dev->evdev,
 				    EV_ABS,
diff --git a/tools/event-debug.c b/tools/event-debug.c
index f0ae1dc..bb818bc 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -339,7 +339,7 @@ tablet_axis_changed_sym(struct libinput_event_tablet *t,
 static void
 print_tablet_axes(struct libinput_event_tablet *t)
 {
-	struct libinput_tool *tool = libinput_event_tablet_get_tool(t);
+	struct libinput_tablet_tool *tool = libinput_event_tablet_get_tool(t);
 	double x, y, dx, dy;
 	double dist, pressure;
 	double rotation, slider, wheel;
@@ -457,7 +457,7 @@ static void
 print_proximity_event(struct libinput_event *ev)
 {
 	struct libinput_event_tablet *t = libinput_event_get_tablet_event(ev);
-	struct libinput_tool *tool = libinput_event_tablet_get_tool(t);
+	struct libinput_tablet_tool *tool = libinput_event_tablet_get_tool(t);
 	enum libinput_tool_proximity_state state;
 	const char *tool_str,
 	           *state_str;
-- 
2.5.0



More information about the wayland-devel mailing list