From d01868413ff12b09729a07b0f1ccef2adb40361a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 12 May 2022 19:01:26 +0200 Subject: server: add wl_global_get_version Add a helper to check the advertised version of a global. This can be handy when checking whether a compositor feature is supported, instead of having to store the version passed to wl_global_create separately. Signed-off-by: Simon Ser --- src/wayland-server-core.h | 3 +++ src/wayland-server.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h index ab5b448..7a1375f 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); +uint32_t +wl_global_get_version(const struct wl_global *global); + struct wl_display * wl_global_get_display(const struct wl_global *global); diff --git a/src/wayland-server.c b/src/wayland-server.c index 71b0360..93e42c7 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -1315,6 +1315,20 @@ wl_global_get_interface(const struct wl_global *global) return global->interface; } +/** Get the version of the given global. + * + * \param global The global object. + * \return The version advertised by the global. + * + * \memberof wl_global + * \since 1.21 + */ +WL_EXPORT uint32_t +wl_global_get_version(const struct wl_global *global) +{ + return global->version; +} + /** Get the display object for the given global * * \param global The global object -- cgit v1.2.3-70-g09d2