From 9f5c38d1211f57da09f1c1323de04e519523c526 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 7 Oct 2014 20:23:55 -0700 Subject: [PATCH] wayland: Make the MetaWaylandRegion type opaque --- src/wayland/meta-wayland-region.c | 12 ++++++++++++ src/wayland/meta-wayland-region.h | 8 ++------ src/wayland/meta-wayland-surface.c | 6 ++++-- src/wayland/meta-wayland-types.h | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/wayland/meta-wayland-region.c b/src/wayland/meta-wayland-region.c index fcfcbd9b1..a4d347f68 100644 --- a/src/wayland/meta-wayland-region.c +++ b/src/wayland/meta-wayland-region.c @@ -26,6 +26,12 @@ #include "meta-wayland-region.h" +struct _MetaWaylandRegion +{ + struct wl_resource *resource; + cairo_region_t *region; +}; + static void wl_region_destroy (struct wl_client *client, struct wl_resource *resource) @@ -91,3 +97,9 @@ meta_wayland_region_create (MetaWaylandCompositor *compositor, return region; } + +cairo_region_t * +meta_wayland_region_peek_cairo_region (MetaWaylandRegion *region) +{ + return region->region; +} diff --git a/src/wayland/meta-wayland-region.h b/src/wayland/meta-wayland-region.h index 830785dca..3ec8ab1a0 100644 --- a/src/wayland/meta-wayland-region.h +++ b/src/wayland/meta-wayland-region.h @@ -30,15 +30,11 @@ #include #include "meta-wayland-types.h" -typedef struct -{ - struct wl_resource *resource; - cairo_region_t *region; -} MetaWaylandRegion; - MetaWaylandRegion * meta_wayland_region_create (MetaWaylandCompositor *compositor, struct wl_client *client, struct wl_resource *compositor_resource, guint32 id); +cairo_region_t * meta_wayland_region_peek_cairo_region (MetaWaylandRegion *region); + #endif /* META_WAYLAND_REGION_H */ diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index c929ca0f8..c61598b33 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -540,7 +540,8 @@ wl_surface_set_opaque_region (struct wl_client *client, if (region_resource) { MetaWaylandRegion *region = wl_resource_get_user_data (region_resource); - surface->pending.opaque_region = cairo_region_copy (region->region); + cairo_region_t *cr_region = meta_wayland_region_peek_cairo_region (region); + surface->pending.opaque_region = cairo_region_copy (cr_region); } } @@ -559,7 +560,8 @@ wl_surface_set_input_region (struct wl_client *client, if (region_resource) { MetaWaylandRegion *region = wl_resource_get_user_data (region_resource); - surface->pending.input_region = cairo_region_copy (region->region); + cairo_region_t *cr_region = meta_wayland_region_peek_cairo_region (region); + surface->pending.input_region = cairo_region_copy (cr_region); } } diff --git a/src/wayland/meta-wayland-types.h b/src/wayland/meta-wayland-types.h index 66b33aa07..f28a34df9 100644 --- a/src/wayland/meta-wayland-types.h +++ b/src/wayland/meta-wayland-types.h @@ -32,6 +32,7 @@ typedef struct _MetaWaylandDataSource MetaWaylandDataSource; typedef struct _MetaWaylandDataDevice MetaWaylandDataDevice; typedef struct _MetaWaylandBuffer MetaWaylandBuffer; +typedef struct _MetaWaylandRegion MetaWaylandRegion; typedef struct _MetaWaylandSurface MetaWaylandSurface;