summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2016-08-09 12:46:52 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-08-11 15:52:07 +0300
commit68abfa6732672ab3534102de55edaa10343f4d1b (patch)
treeb785fb32fc37ba79e4748fd511325e6ca80e8866
parentbe48da6a42b399252959ef782132fdfdf62c6905 (diff)
Add API to retrieve the interface name of a wl_resource
Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
-rw-r--r--src/wayland-server-core.h2
-rw-r--r--src/wayland-server.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index 43e76fb..c0d25e9 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -427,6 +427,8 @@ int
wl_resource_instance_of(struct wl_resource *resource,
const struct wl_interface *interface,
const void *implementation);
+const char *
+wl_resource_get_class(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 b44ec9c..e2212e2 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -690,6 +690,18 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
return wl_signal_get(&resource->destroy_signal, notify);
}
+/** Retrieve the interface name (class) of a resource object.
+ *
+ * \param resource The resource object
+ *
+ * \memberof wl_resource
+ */
+WL_EXPORT const char *
+wl_resource_get_class(struct wl_resource *resource)
+{
+ return resource->object.interface->name;
+}
+
WL_EXPORT void
wl_client_add_destroy_listener(struct wl_client *client,
struct wl_listener *listener)