diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h index ce91a6f..af50f1e 100644 --- a/src/wayland-client-core.h +++ b/src/wayland-client-core.h @@ -219,6 +219,9 @@ wl_proxy_get_tag(struct wl_proxy *proxy); const char * wl_proxy_get_class(struct wl_proxy *proxy); +struct wl_display * +wl_proxy_get_display(struct wl_proxy *proxy); + void wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue); diff --git a/src/wayland-client.c b/src/wayland-client.c index 607fdb4..489f0a8 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -2338,6 +2338,20 @@ wl_proxy_get_class(struct wl_proxy *proxy) return proxy->object.interface->name; } +/** Get the display of a proxy object + * + * \param proxy The proxy object + * \return The wl_display the proxy is associated with + * + * \memberof wl_proxy + * \since 1.23 + */ +WL_EXPORT struct wl_display * +wl_proxy_get_display(struct wl_proxy *proxy) +{ + return proxy->display; +} + /** Assign a proxy to an event queue * * \param proxy The proxy object diff --git a/tests/proxy-test.c b/tests/proxy-test.c index c09468d..2a8f425 100644 --- a/tests/proxy-test.c +++ b/tests/proxy-test.c @@ -118,6 +118,8 @@ TEST(proxy_tag) wl_proxy_set_tag((struct wl_proxy *) client.callback_b, &tag_b); + assert(wl_proxy_get_display((struct wl_proxy *) client.callback_b) == client.display); + wl_display_flush(client.display); while (server.sync_count < 2) {