struct weston_region *region;
if (region_resource) {
- region = region_resource->data;
+ region = wl_resource_get_user_data(region_resource);
pixman_region32_copy(&surface->pending.opaque,
®ion->region);
} else {
struct weston_region *region;
if (region_resource) {
- region = region_resource->data;
+ region = wl_resource_get_user_data(region_resource);
pixman_region32_copy(&surface->pending.input,
®ion->region);
} else {
static void
destroy_region(struct wl_resource *resource)
{
- struct weston_region *region =
- container_of(resource, struct weston_region, resource);
+ struct weston_region *region = wl_resource_get_user_data(resource);
pixman_region32_fini(®ion->region);
free(region);
region_add(struct wl_client *client, struct wl_resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
- struct weston_region *region = resource->data;
+ struct weston_region *region = wl_resource_get_user_data(resource);
pixman_region32_union_rect(®ion->region, ®ion->region,
x, y, width, height);
region_subtract(struct wl_client *client, struct wl_resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
- struct weston_region *region = resource->data;
+ struct weston_region *region = wl_resource_get_user_data(resource);
pixman_region32_t rect;
pixman_region32_init_rect(&rect, x, y, width, height);
return;
}
- region->resource.destroy = destroy_region;
-
- region->resource.object.id = id;
- region->resource.object.interface = &wl_region_interface;
- region->resource.object.implementation =
- (void (**)(void)) ®ion_interface;
- region->resource.data = region;
-
pixman_region32_init(®ion->region);
- wl_client_add_resource(client, ®ion->resource);
+ region->resource = wl_client_add_object(client, &wl_region_interface,
+ ®ion_interface, id, region);
+ wl_resource_set_destructor(region->resource, destroy_region);
}
static const struct wl_compositor_interface compositor_interface = {