From 0f67580aab115e9667650d52104e3ea3a5dfe20b Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Thu, 22 Jun 2023 15:05:34 +0300 Subject: compositor: introduce wlr_surface_set_role_object() --- include/wlr/types/wlr_compositor.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 6a8bebdd..c8b63a59 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -230,17 +230,22 @@ typedef void (*wlr_surface_iterator_func_t)(struct wlr_surface *surface, int sx, int sy, void *data); /** - * Set the lifetime role for this surface. Returns true on success or false if - * the role cannot be set. + * Set the lifetime role for this surface. * - * If the role is represented by an object, role_data must be non-NULL. - * Alternatively, if the role isn't represented by any object, role_data must - * be NULL. + * If the surface already has a different role and/or has a role object set, + * the function fails and sends an error to the client. + * + * Returns true on success, false otherwise. */ -bool wlr_surface_set_role(struct wlr_surface *surface, - const struct wlr_surface_role *role, void *role_data, +bool wlr_surface_set_role(struct wlr_surface *surface, const struct wlr_surface_role *role, struct wl_resource *error_resource, uint32_t error_code); +/** + * Set the role object for this surface. The surface must have a role and + * no already set role object. + */ +void wlr_surface_set_role_object(struct wlr_surface *surface, void *role_data); + /** * Destroy the object representing the surface's role. If it doesn't exist, * this function is no-op. -- cgit v1.2.3