subsurfaces: Use wl_resource_get accessors for subsurfaces
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
diff --git a/src/compositor.c b/src/compositor.c
index e57f61f..5c82413 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1975,7 +1975,7 @@
subsurface_set_position(struct wl_client *client,
struct wl_resource *resource, int32_t x, int32_t y)
{
- struct weston_subsurface *sub = resource->data;
+ struct weston_subsurface *sub = wl_resource_get_user_data(resource);
if (!sub)
return;
@@ -2034,7 +2034,7 @@
struct wl_resource *resource,
struct wl_resource *sibling_resource)
{
- struct weston_subsurface *sub = resource->data;
+ struct weston_subsurface *sub = wl_resource_get_user_data(resource);
struct weston_surface *surface =
wl_resource_get_user_data(sibling_resource);
struct weston_subsurface *sibling;
@@ -2056,7 +2056,7 @@
struct wl_resource *resource,
struct wl_resource *sibling_resource)
{
- struct weston_subsurface *sub = resource->data;
+ struct weston_subsurface *sub = wl_resource_get_user_data(resource);
struct weston_surface *surface =
wl_resource_get_user_data(sibling_resource);
struct weston_subsurface *sibling;
@@ -2076,7 +2076,7 @@
static void
subsurface_set_sync(struct wl_client *client, struct wl_resource *resource)
{
- struct weston_subsurface *sub = resource->data;
+ struct weston_subsurface *sub = wl_resource_get_user_data(resource);
if (sub)
sub->synchronized = 1;
@@ -2085,7 +2085,7 @@
static void
subsurface_set_desync(struct wl_client *client, struct wl_resource *resource)
{
- struct weston_subsurface *sub = resource->data;
+ struct weston_subsurface *sub = wl_resource_get_user_data(resource);
if (sub && sub->synchronized) {
sub->synchronized = 0;
@@ -2142,7 +2142,7 @@
/* The protocol object (wl_resource) is left inert. */
if (sub->resource)
- sub->resource->data = NULL;
+ wl_resource_set_user_data(sub->resource, NULL);
weston_subsurface_destroy(sub);
}
@@ -2165,7 +2165,7 @@
static void
subsurface_resource_destroy(struct wl_resource *resource)
{
- struct weston_subsurface *sub = resource->data;
+ struct weston_subsurface *sub = wl_resource_get_user_data(resource);
if (sub)
weston_subsurface_destroy(sub);
@@ -2262,7 +2262,7 @@
return NULL;
}
- sub->resource->destroy = subsurface_resource_destroy;
+ wl_resource_set_destructor(sub->resource, subsurface_resource_destroy);
weston_subsurface_link_surface(sub, surface);
weston_subsurface_link_parent(sub, parent);
weston_subsurface_cache_init(sub);
@@ -2311,7 +2311,7 @@
wl_resource_post_error(resource,
WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE,
"%s%d: wl_surface@%d cannot be its own parent",
- where, id, surface_resource->object.id);
+ where, id, wl_resource_get_id(surface_resource));
return;
}
@@ -2319,7 +2319,7 @@
wl_resource_post_error(resource,
WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE,
"%s%d: wl_surface@%d is already a sub-surface",
- where, id, surface_resource->object.id);
+ where, id, wl_resource_get_id(surface_resource));
return;
}
@@ -2327,7 +2327,7 @@
wl_resource_post_error(resource,
WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE,
"%s%d: wl_surface@%d already has a role",
- where, id, surface_resource->object.id);
+ where, id, wl_resource_get_id(surface_resource));
return;
}
@@ -2335,7 +2335,7 @@
wl_resource_post_error(resource,
WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE,
"%s%d: wl_surface@%d is an ancestor of parent",
- where, id, surface_resource->object.id);
+ where, id, wl_resource_get_id(surface_resource));
return;
}