[PATCH libinput 2/2] tablet: Add libinput_tool_get/set_user_data()

Stephen Chandler Paul thatslyude at gmail.com
Tue Aug 5 14:49:39 PDT 2014


Signed-off-by: Stephen Chandler Paul <thatslyude at gmail.com>
---
 src/libinput-private.h |  1 +
 src/libinput.c         | 13 +++++++++++++
 src/libinput.h         | 23 +++++++++++++++++++++++
 3 files changed, 37 insertions(+)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 6ec3637..8187564 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -109,6 +109,7 @@ struct libinput_tool {
 	uint32_t serial;
 	enum libinput_tool_type type;
 	int refcount;
+	void *user_data;
 };
 
 typedef void (*libinput_source_dispatch_t)(void *data);
diff --git a/src/libinput.c b/src/libinput.c
index a7de795..7b17eec 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -613,6 +613,19 @@ libinput_tool_get_serial(struct libinput_tool *tool)
 	return tool->serial;
 }
 
+LIBINPUT_EXPORT void
+libinput_tool_set_user_data(struct libinput_tool *tool,
+			    void *user_data)
+{
+	tool->user_data = user_data;
+}
+
+LIBINPUT_EXPORT void *
+libinput_tool_get_user_data(struct libinput_tool *tool)
+{
+	return tool->user_data;
+}
+
 LIBINPUT_EXPORT struct libinput_tool *
 libinput_tool_ref(struct libinput_tool *tool)
 {
diff --git a/src/libinput.h b/src/libinput.h
index bde15a1..69b5870 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -1048,6 +1048,29 @@ uint32_t
 libinput_tool_get_serial(struct libinput_tool *tool);
 
 /**
+ * @ingroup event_tablet
+ *
+ * Return the user data associated with a tool object.
+ *
+ * @param tool The libinput tool
+ * @return The user data associated with the tool object
+ */
+void *
+libinput_tool_get_user_data(struct libinput_tool *tool);
+
+/**
+ * @ingroup event_tablet
+ *
+ * Set the user data associated with a tool object.
+ *
+ * @param tool The libinput tool
+ * @param user_data The user data to associate with the tool object
+ */
+void
+libinput_tool_set_user_data(struct libinput_tool *tool,
+			    void *user_data);
+
+/**
  * @defgroup base Initialization and manipulation of libinput contexts
  */
 
-- 
1.8.5.5



More information about the wayland-devel mailing list