aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-06-07 09:34:19 +0300
committerSimon Ser <contact@emersion.fr>2023-06-14 14:06:28 +0000
commit753f3cc4fa2aa1d541be12ccc9f81dc9531e23cf (patch)
treebe46eee33dba81fb1424740fac275c518ebc074f /include
parent2d9659d765b9da1a0ad3d7ea4a064ba08eee6260 (diff)
compositor: add wlr_surface_role.no_object
This commit allows to make a role as not represented by an object, which fixes calling role commit handlers for roles like cursor surfaces. Fixes: 099b9de752f9cc212140533a8a2e20b31aa9028f
Diffstat (limited to 'include')
-rw-r--r--include/wlr/types/wlr_compositor.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index 649f5ab3..6a8bebdd 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -74,7 +74,15 @@ struct wlr_surface_state {
struct wlr_surface_role {
const char *name;
/**
+ * If true, the role isn't represented by any object.
+ * For example, this applies to cursor surfaces.
+ */
+ bool no_object;
+ /**
* Called when a new surface state is committed. May be NULL.
+ *
+ * If the role is represented by an object, this is only called if
+ * such object exists.
*/
void (*commit)(struct wlr_surface *surface);
/**
@@ -224,6 +232,10 @@ typedef void (*wlr_surface_iterator_func_t)(struct wlr_surface *surface,
/**
* Set the lifetime role for this surface. Returns true on success or false if
* the role cannot be set.
+ *
+ * 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.
*/
bool wlr_surface_set_role(struct wlr_surface *surface,
const struct wlr_surface_role *role, void *role_data,