[PATCH] Add wl_resource_get_implementation

Neil Roberts neil at linux.intel.com
Tue May 20 04:07:57 PDT 2014


This gets the implementation for a resource that was set in the
implementation argument of wl_resource_set_implementation or
wl_resource_set_dispatcher. This is mostly useful in conjuction with a
dispatcher which may want to dispatch via the implementation pointers
or just store some extra information there.
---
 src/wayland-server.c | 6 ++++++
 src/wayland-server.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 1c9d4d0..4ce219a 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1166,6 +1166,12 @@ wl_resource_set_implementation(struct wl_resource *resource,
 	resource->dispatcher = NULL;
 }
 
+WL_EXPORT const void *
+wl_resource_get_implementation(struct wl_resource *resource)
+{
+	return resource->object.implementation;
+}
+
 WL_EXPORT void
 wl_resource_set_dispatcher(struct wl_resource *resource,
 			   wl_dispatcher_func_t dispatcher,
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 24cd53f..4f56457 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -369,6 +369,8 @@ wl_resource_set_implementation(struct wl_resource *resource,
 			       const void *implementation,
 			       void *data,
 			       wl_resource_destroy_func_t destroy);
+const void *
+wl_resource_get_implementation(struct wl_resource *resource);
 void
 wl_resource_set_dispatcher(struct wl_resource *resource,
 			   wl_dispatcher_func_t dispatcher,
-- 
1.9.0



More information about the wayland-devel mailing list