aboutsummaryrefslogtreecommitdiff
path: root/xwayland/shell.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-06-23 14:23:27 +0200
committerSimon Ser <contact@emersion.fr>2023-06-23 14:23:27 +0200
commit89cb4842208a2997cfa3a9bef7ac66e01a414ebb (patch)
tree677299cb6d84a93565a8878200752ff1715d0fb2 /xwayland/shell.c
parent00f1870d3566041e2e1ef2502dc52140f23bc556 (diff)
compositor: replace role_data with role_resource
This increases type safety, makes it more obvious that role_data must represent the role object, and will allow for automatic cleanup when the resource is destroyed.
Diffstat (limited to 'xwayland/shell.c')
-rw-r--r--xwayland/shell.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xwayland/shell.c b/xwayland/shell.c
index d362cb7d..28f572d3 100644
--- a/xwayland/shell.c
+++ b/xwayland/shell.c
@@ -38,7 +38,7 @@ static struct wlr_xwayland_surface_v1 *xwl_surface_from_resource(
}
static void xwl_surface_role_commit(struct wlr_surface *surface) {
- struct wlr_xwayland_surface_v1 *xwl_surface = surface->role_data;
+ struct wlr_xwayland_surface_v1 *xwl_surface = xwl_surface_from_resource(surface->role_resource);
if (xwl_surface->serial != 0 && !xwl_surface->added) {
xwl_surface->added = true;
@@ -48,7 +48,7 @@ static void xwl_surface_role_commit(struct wlr_surface *surface) {
}
static void xwl_surface_role_destroy(struct wlr_surface *surface) {
- struct wlr_xwayland_surface_v1 *xwl_surface = surface->role_data;
+ struct wlr_xwayland_surface_v1 *xwl_surface = xwl_surface_from_resource(surface->role_resource);
wl_list_remove(&xwl_surface->surface_destroy.link);
wl_list_remove(&xwl_surface->link);
wl_resource_set_user_data(xwl_surface->resource, NULL); // make inert
@@ -131,7 +131,7 @@ static void shell_handle_get_xwayland_surface(struct wl_client *client,
wl_resource_set_implementation(xwl_surface->resource, &xwl_surface_impl,
xwl_surface, xwl_surface_handle_resource_destroy);
- wlr_surface_set_role_object(surface, xwl_surface);
+ wlr_surface_set_role_object(surface, xwl_surface->resource);
wl_list_insert(&shell->surfaces, &xwl_surface->link);