summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2013-06-14 10:07:52 -0500
committerKristian Høgsberg <krh@bitplanet.net>2013-06-14 15:56:08 -0400
commit61ac9c68490b311afc4e34f0c515bef85f66a69a (patch)
treedec174898639713cc470f4f998c119fcb61d337c
parent885d0575369be5e4ee7c1e000b7f612876056bbb (diff)
server: Add aditional wl_resource accessors
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
-rw-r--r--src/wayland-server.c30
-rw-r--r--src/wayland-server.h6
2 files changed, 36 insertions, 0 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 2052f88..e2776ff 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -452,12 +452,42 @@ wl_resource_get_link(struct wl_resource *resource)
return &resource->link;
}
+WL_EXPORT struct wl_resource *
+wl_resource_from_link(struct wl_list *link)
+{
+ struct wl_resource *resource;
+
+ return wl_container_of(link, resource, link);
+}
+
+WL_EXPORT struct wl_resource *
+wl_resource_find_for_client(struct wl_list *list, struct wl_client *client)
+{
+ struct wl_resource *resource;
+
+ if (client == NULL)
+ return NULL;
+
+ wl_list_for_each(resource, list, link) {
+ if (resource->client == client)
+ return resource;
+ }
+
+ return NULL;
+}
+
WL_EXPORT struct wl_client *
wl_resource_get_client(struct wl_resource *resource)
{
return resource->client;
}
+WL_EXPORT void
+wl_resource_set_user_data(struct wl_resource *resource, void *data)
+{
+ resource->data = data;
+}
+
WL_EXPORT void *
wl_resource_get_user_data(struct wl_resource *resource)
{
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 84c36cb..cffe7f6 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -260,8 +260,14 @@ uint32_t
wl_resource_get_id(struct wl_resource *resource);
struct wl_list *
wl_resource_get_link(struct wl_resource *resource);
+struct wl_resource *
+wl_resource_from_link(struct wl_list *resource);
+struct wl_resource *
+wl_resource_find_for_client(struct wl_list *list, struct wl_client *client);
struct wl_client *
wl_resource_get_client(struct wl_resource *resource);
+void
+wl_resource_set_user_data(struct wl_resource *resource, void *data);
void *
wl_resource_get_user_data(struct wl_resource *resource);
void