diff options
-rw-r--r-- | include/wlr/types/wlr_region.h | 2 | ||||
-rw-r--r-- | types/wlr_compositor.c | 4 | ||||
-rw-r--r-- | types/wlr_pointer_constraints_v1.c | 2 | ||||
-rw-r--r-- | types/wlr_region.c | 24 |
4 files changed, 19 insertions, 13 deletions
diff --git a/include/wlr/types/wlr_region.h b/include/wlr/types/wlr_region.h index e731c8b1..62ac85c0 100644 --- a/include/wlr/types/wlr_region.h +++ b/include/wlr/types/wlr_region.h @@ -25,6 +25,6 @@ struct wl_resource; * * To allow clients to create wl_region objects, call wlr_compositor_create(). */ -pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource); +const pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource); #endif diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index 5e6de244..d5e5fd0e 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -123,7 +123,7 @@ static void surface_handle_set_opaque_region(struct wl_client *client, struct wlr_surface *surface = wlr_surface_from_resource(resource); surface->pending.committed |= WLR_SURFACE_STATE_OPAQUE_REGION; if (region_resource) { - pixman_region32_t *region = wlr_region_from_resource(region_resource); + const pixman_region32_t *region = wlr_region_from_resource(region_resource); pixman_region32_copy(&surface->pending.opaque, region); } else { pixman_region32_clear(&surface->pending.opaque); @@ -136,7 +136,7 @@ static void surface_handle_set_input_region(struct wl_client *client, struct wlr_surface *surface = wlr_surface_from_resource(resource); surface->pending.committed |= WLR_SURFACE_STATE_INPUT_REGION; if (region_resource) { - pixman_region32_t *region = wlr_region_from_resource(region_resource); + const pixman_region32_t *region = wlr_region_from_resource(region_resource); pixman_region32_copy(&surface->pending.input, region); } else { pixman_region32_fini(&surface->pending.input); diff --git a/types/wlr_pointer_constraints_v1.c b/types/wlr_pointer_constraints_v1.c index 7a8d209b..1abbeed2 100644 --- a/types/wlr_pointer_constraints_v1.c +++ b/types/wlr_pointer_constraints_v1.c @@ -72,7 +72,7 @@ static void pointer_constraint_set_region( pixman_region32_clear(&constraint->pending.region); if (region_resource) { - pixman_region32_t *region = wlr_region_from_resource(region_resource); + const pixman_region32_t *region = wlr_region_from_resource(region_resource); pixman_region32_copy(&constraint->pending.region, region); } diff --git a/types/wlr_region.c b/types/wlr_region.c index db4f09a3..071f53fc 100644 --- a/types/wlr_region.c +++ b/types/wlr_region.c @@ -6,15 +6,27 @@ #include <wlr/types/wlr_region.h> #include "types/wlr_region.h" +static const struct wl_region_interface region_impl; + +static pixman_region32_t *region_from_resource(struct wl_resource *resource) { + assert(wl_resource_instance_of(resource, &wl_region_interface, + ®ion_impl)); + return wl_resource_get_user_data(resource); +} + +const pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource) { + return region_from_resource(resource); +} + static void region_add(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { - pixman_region32_t *region = wlr_region_from_resource(resource); + pixman_region32_t *region = region_from_resource(resource); pixman_region32_union_rect(region, region, x, y, width, height); } static void region_subtract(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { - pixman_region32_t *region = wlr_region_from_resource(resource); + pixman_region32_t *region = region_from_resource(resource); pixman_region32_union_rect(region, region, x, y, width, height); pixman_region32_t rect; @@ -34,7 +46,7 @@ static const struct wl_region_interface region_impl = { }; static void region_handle_resource_destroy(struct wl_resource *resource) { - pixman_region32_t *reg = wlr_region_from_resource(resource); + pixman_region32_t *reg = region_from_resource(resource); pixman_region32_fini(reg); free(reg); } @@ -61,9 +73,3 @@ struct wl_resource *region_create(struct wl_client *client, return region_resource; } - -pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource) { - assert(wl_resource_instance_of(resource, &wl_region_interface, - ®ion_impl)); - return wl_resource_get_user_data(resource); -} |