tablet: Add libinput_tool_get/set_user_data()

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Stephen Chandler Paul 2014-08-05 17:49:39 -04:00 committed by Peter Hutterer
parent 78b474ee37
commit 11e0558f91
3 changed files with 37 additions and 0 deletions

View file

@ -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);

View file

@ -599,6 +599,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)
{

View file

@ -1034,6 +1034,29 @@ libinput_tool_unref(struct libinput_tool *tool);
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
*/