[RFC weston 11/12] subsurfaces: Use wl_resource_get accessors for subsurfaces
Jason Ekstrand
jason at jlekstrand.net
Fri Jun 14 08:08:02 PDT 2013
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/compositor.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 28be309..320acd8 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1973,7 +1973,7 @@ static void
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;
@@ -2032,7 +2032,7 @@ subsurface_place_above(struct wl_client *client,
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;
@@ -2054,7 +2054,7 @@ subsurface_place_below(struct wl_client *client,
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;
@@ -2074,7 +2074,7 @@ subsurface_place_below(struct wl_client *client,
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;
@@ -2083,7 +2083,7 @@ subsurface_set_sync(struct wl_client *client, struct wl_resource *resource)
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;
@@ -2140,7 +2140,7 @@ subsurface_handle_surface_destroy(struct wl_listener *listener, void *data)
/* 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);
}
@@ -2163,7 +2163,7 @@ subsurface_handle_parent_destroy(struct wl_listener *listener, void *data)
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);
@@ -2260,7 +2260,7 @@ weston_subsurface_create(uint32_t id, struct weston_surface *surface,
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);
@@ -2309,7 +2309,7 @@ subcompositor_get_subsurface(struct wl_client *client,
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;
}
@@ -2317,7 +2317,7 @@ subcompositor_get_subsurface(struct wl_client *client,
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;
}
@@ -2325,7 +2325,7 @@ subcompositor_get_subsurface(struct wl_client *client,
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;
}
@@ -2333,7 +2333,7 @@ subcompositor_get_subsurface(struct wl_client *client,
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;
}
--
1.8.1.4
More information about the wayland-devel
mailing list