From 1fc0123ba79212c042ed8211a857f508e1a98169 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Tue, 1 Oct 2024 15:42:06 +0300 Subject: [PATCH] ext-foreign-toplevel-list: add _from_resource() --- include/wlr/types/wlr_ext_foreign_toplevel_list_v1.h | 3 +++ types/wlr_ext_foreign_toplevel_list_v1.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/wlr/types/wlr_ext_foreign_toplevel_list_v1.h b/include/wlr/types/wlr_ext_foreign_toplevel_list_v1.h index a5ba9d38..b2e4c7b0 100644 --- a/include/wlr/types/wlr_ext_foreign_toplevel_list_v1.h +++ b/include/wlr/types/wlr_ext_foreign_toplevel_list_v1.h @@ -64,4 +64,7 @@ void wlr_ext_foreign_toplevel_handle_v1_update_state( struct wlr_ext_foreign_toplevel_handle_v1 *toplevel, const struct wlr_ext_foreign_toplevel_handle_v1_state *state); +struct wlr_ext_foreign_toplevel_handle_v1 *wlr_ext_foreign_toplevel_handle_v1_from_resource( + struct wl_resource *resource); + #endif diff --git a/types/wlr_ext_foreign_toplevel_list_v1.c b/types/wlr_ext_foreign_toplevel_list_v1.c index 22a126f8..a773ee8a 100644 --- a/types/wlr_ext_foreign_toplevel_list_v1.c +++ b/types/wlr_ext_foreign_toplevel_list_v1.c @@ -54,6 +54,13 @@ static bool update_string(struct wlr_ext_foreign_toplevel_handle_v1 *toplevel, return true; } +struct wlr_ext_foreign_toplevel_handle_v1 *wlr_ext_foreign_toplevel_handle_v1_from_resource( + struct wl_resource *resource) { + assert(wl_resource_instance_of(resource, &ext_foreign_toplevel_handle_v1_interface, + &toplevel_handle_impl)); + return wl_resource_get_user_data(resource); +} + void wlr_ext_foreign_toplevel_handle_v1_update_state( struct wlr_ext_foreign_toplevel_handle_v1 *toplevel, const struct wlr_ext_foreign_toplevel_handle_v1_state *state) {