[PATCH] server: Add get/set user data for wl_client

Sung-Jin Park sj76.park at samsung.com
Wed Jan 27 02:34:56 PST 2016


Signed-off-by: Sung-Jin Park <sj76.park at samsung.com>
---
 src/wayland-server-core.h |  6 ++++++
 src/wayland-server.c      | 13 +++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index e8e1e9c..6990423 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -186,6 +186,12 @@ int
 wl_client_get_fd(struct wl_client *client);
 
 void
+wl_client_set_user_data(struct wl_client *client, void *data);
+
+void *
+wl_client_get_user_data(struct wl_client *client);
+
+void
 wl_client_add_destroy_listener(struct wl_client *client,
 			       struct wl_listener *listener);
 
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 6654cd7..e7a6eae 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -81,6 +81,7 @@ struct wl_client {
 	struct wl_signal destroy_signal;
 	struct ucred ucred;
 	int error;
+	void *data;
 };
 
 struct wl_display {
@@ -526,6 +527,18 @@ wl_client_get_fd(struct wl_client *client)
 	return wl_connection_get_fd(client->connection);
 }
 
+WL_EXPORT void
+wl_client_set_user_data(struct wl_client *client, void *data)
+{
+	client->data = data;
+}
+
+WL_EXPORT void *
+wl_client_get_user_data(struct wl_client *client)
+{
+	return client->data;
+}
+
 /** Look up an object in the client name space
  *
  * \param client The client object
-- 
1.9.1



More information about the wayland-devel mailing list