From 015670f10e5c6f97afc2bb4b847497cf5b575c25 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Tue, 23 May 2023 10:24:28 +0900 Subject: [PATCH] xdg_shell_v6: Add ds_xdg_surface_v6_from_resource() Change-Id: Ie357eff7049a409a3bed99e65a77085aa69b5a50 --- include/libds/xdg_shell_v6.h | 3 +++ src/xdg_shell_v6/xdg_surface_v6.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/libds/xdg_shell_v6.h b/include/libds/xdg_shell_v6.h index 34916f6..df3ede2 100644 --- a/include/libds/xdg_shell_v6.h +++ b/include/libds/xdg_shell_v6.h @@ -40,6 +40,9 @@ void ds_xdg_shell_v6_add_new_surface_listener(struct ds_xdg_shell_v6 *shell, struct wl_listener *listener); +struct ds_xdg_surface_v6 * +ds_xdg_surface_v6_from_resource(struct wl_resource *resource); + void ds_xdg_surface_v6_add_destroy_listener(struct ds_xdg_surface_v6 *surface, struct wl_listener *listener); diff --git a/src/xdg_shell_v6/xdg_surface_v6.c b/src/xdg_shell_v6/xdg_surface_v6.c index 51742ed..8483c59 100644 --- a/src/xdg_shell_v6/xdg_surface_v6.c +++ b/src/xdg_shell_v6/xdg_surface_v6.c @@ -15,6 +15,16 @@ static void xdg_surface_v6_handle_resource_destroy(struct wl_resource *resource) static void xdg_surface_v6_configure_destroy(struct ds_xdg_surface_v6_configure *configure); static void surface_send_configure(void *user_data); +WL_EXPORT struct ds_xdg_surface_v6 * +ds_xdg_surface_v6_from_resource(struct wl_resource *resource) +{ + if (!wl_resource_instance_of(resource, &zxdg_surface_v6_interface, + &xdg_surface_v6_impl)) { + return NULL; + } + return wl_resource_get_user_data(resource); +} + void ds_xdg_surface_v6_add_destroy_listener(struct ds_xdg_surface_v6 *surface, struct wl_listener *listener) -- 2.7.4