[PATCH wayland 2/5] Add API to retrieve the interface of a wl_resource

Giulio Camuffo giuliocamuffo at gmail.com
Mon Mar 7 17:31:32 UTC 2016


---
 src/wayland-server-core.h |  2 ++
 src/wayland-server.c      | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index 1bc4d6b..a4ca350 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -419,6 +419,8 @@ int
 wl_resource_instance_of(struct wl_resource *resource,
 			const struct wl_interface *interface,
 			const void *implementation);
+const struct wl_interface *
+wl_resource_get_interface(struct wl_resource *resource);
 
 void
 wl_resource_add_destroy_listener(struct wl_resource *resource,
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 2857b1d..5099614 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -687,6 +687,18 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
 	return wl_signal_get(&resource->destroy_signal, notify);
 }
 
+/** Retrieve the interface of a resource.
+ *
+ * \param resource The resource object
+ *
+ * \memberof wl_resource
+ */
+WL_EXPORT const struct wl_interface *
+wl_resource_get_interface(struct wl_resource *resource)
+{
+	return resource->object.interface;
+}
+
 WL_EXPORT void
 wl_client_add_destroy_listener(struct wl_client *client,
 			       struct wl_listener *listener)
-- 
2.7.2



More information about the wayland-devel mailing list