region: Change resource to a wl_resource pointer
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
committed by
Kristian Høgsberg
parent
651f00e94a
commit
8895efcd0d
+8
-15
@@ -1484,7 +1484,7 @@ surface_set_opaque_region(struct wl_client *client,
|
|||||||
struct weston_region *region;
|
struct weston_region *region;
|
||||||
|
|
||||||
if (region_resource) {
|
if (region_resource) {
|
||||||
region = region_resource->data;
|
region = wl_resource_get_user_data(region_resource);
|
||||||
pixman_region32_copy(&surface->pending.opaque,
|
pixman_region32_copy(&surface->pending.opaque,
|
||||||
®ion->region);
|
®ion->region);
|
||||||
} else {
|
} else {
|
||||||
@@ -1501,7 +1501,7 @@ surface_set_input_region(struct wl_client *client,
|
|||||||
struct weston_region *region;
|
struct weston_region *region;
|
||||||
|
|
||||||
if (region_resource) {
|
if (region_resource) {
|
||||||
region = region_resource->data;
|
region = wl_resource_get_user_data(region_resource);
|
||||||
pixman_region32_copy(&surface->pending.input,
|
pixman_region32_copy(&surface->pending.input,
|
||||||
®ion->region);
|
®ion->region);
|
||||||
} else {
|
} else {
|
||||||
@@ -1676,8 +1676,7 @@ compositor_create_surface(struct wl_client *client,
|
|||||||
static void
|
static void
|
||||||
destroy_region(struct wl_resource *resource)
|
destroy_region(struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
struct weston_region *region =
|
struct weston_region *region = wl_resource_get_user_data(resource);
|
||||||
container_of(resource, struct weston_region, resource);
|
|
||||||
|
|
||||||
pixman_region32_fini(®ion->region);
|
pixman_region32_fini(®ion->region);
|
||||||
free(region);
|
free(region);
|
||||||
@@ -1693,7 +1692,7 @@ static void
|
|||||||
region_add(struct wl_client *client, struct wl_resource *resource,
|
region_add(struct wl_client *client, struct wl_resource *resource,
|
||||||
int32_t x, int32_t y, int32_t width, int32_t height)
|
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,
|
pixman_region32_union_rect(®ion->region, ®ion->region,
|
||||||
x, y, width, height);
|
x, y, width, height);
|
||||||
@@ -1703,7 +1702,7 @@ static void
|
|||||||
region_subtract(struct wl_client *client, struct wl_resource *resource,
|
region_subtract(struct wl_client *client, struct wl_resource *resource,
|
||||||
int32_t x, int32_t y, int32_t width, int32_t height)
|
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_t rect;
|
||||||
|
|
||||||
pixman_region32_init_rect(&rect, x, y, width, height);
|
pixman_region32_init_rect(&rect, x, y, width, height);
|
||||||
@@ -1729,17 +1728,11 @@ compositor_create_region(struct wl_client *client,
|
|||||||
return;
|
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);
|
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 = {
|
static const struct wl_compositor_interface compositor_interface = {
|
||||||
|
|||||||
+1
-1
@@ -571,7 +571,7 @@ struct weston_buffer_reference {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct weston_region {
|
struct weston_region {
|
||||||
struct wl_resource resource;
|
struct wl_resource *resource;
|
||||||
pixman_region32_t region;
|
pixman_region32_t region;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user