diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2016-10-18 16:23:40 +0200 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-01-24 15:49:03 +0200 |
commit | 65b773e51fe874c78785fe3e63a8d6972fa0c57c (patch) | |
tree | 11a041768b91469f02a3f6018cadd75cd394a3ab /src | |
parent | d915447365be68a39607a176e03e06a05cb8a72d (diff) |
wayland-server: Add functions to wl_global
When using a wl_global, a server may need to retrieve the associated
wl_interface and user data.
Add a couple of convenient functions wl_global_get_interface() and
wl_global_get_user_data() for this purpose.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/wayland-server-core.h | 6 | ||||
-rw-r--r-- | src/wayland-server.c | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h index 9ae51dc..61da8ab 100644 --- a/src/wayland-server-core.h +++ b/src/wayland-server-core.h @@ -193,6 +193,12 @@ wl_display_set_global_filter(struct wl_display *display, wl_display_global_filter_func_t filter, void *data); +const struct wl_interface * +wl_global_get_interface(const struct wl_global *global); + +void * +wl_global_get_user_data(const struct wl_global *global); + struct wl_client * wl_client_create(struct wl_display *display, int fd); diff --git a/src/wayland-server.c b/src/wayland-server.c index 893bb56..4360874 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -1113,6 +1113,18 @@ wl_global_destroy(struct wl_global *global) free(global); } +WL_EXPORT const struct wl_interface * +wl_global_get_interface(const struct wl_global *global) +{ + return global->interface; +} + +WL_EXPORT void * +wl_global_get_user_data(const struct wl_global *global) +{ + return global->data; +} + /** Get the current serial number * * \param display The display object |