summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Zahorodnii <vlad.zahorodnii@kde.org>2021-02-24 16:02:54 +0200
committerSimon Ser <contact@emersion.fr>2021-03-05 09:12:33 +0000
commit2b22160fb690a76247aa9bd0be3069ff43e8239f (patch)
tree97593fa4833d65e4c723ab42a6c5b5b7114d4619
parent727c7903b27870bed0063814dd594466f21bf6eb (diff)
server: add wl_display getter for wl_global
This can be useful if the compositor wants to call wl_global_destroy() with some delay but it doesn't have the wl_display object associated with the global, which is needed to get access to the event loop. Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
-rw-r--r--src/wayland-server-core.h3
-rw-r--r--src/wayland-server.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index 64d7169..cbc70c0 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -279,6 +279,9 @@ wl_display_set_global_filter(struct wl_display *display,
const struct wl_interface *
wl_global_get_interface(const struct wl_global *global);
+struct wl_display *
+wl_global_get_display(const struct wl_global *global);
+
void *
wl_global_get_user_data(const struct wl_global *global);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 0ce5daf..0120326 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1277,6 +1277,20 @@ wl_global_get_interface(const struct wl_global *global)
return global->interface;
}
+/** Get the display object for the given global
+ *
+ * \param global The global object
+ * \return The display object the global is associated with.
+ *
+ * \memberof wl_global
+ * \since 1.20
+ */
+WL_EXPORT struct wl_display *
+wl_global_get_display(const struct wl_global *global)
+{
+ return global->display;
+}
+
WL_EXPORT void *
wl_global_get_user_data(const struct wl_global *global)
{