[mutter] wayland: Make the MetaWaylandRegion type opaque



commit 9f5c38d1211f57da09f1c1323de04e519523c526
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Oct 7 20:23:55 2014 -0700

    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 fcfcbd9..a4d347f 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 830785d..3ec8ab1 100644
--- a/src/wayland/meta-wayland-region.h
+++ b/src/wayland/meta-wayland-region.h
@@ -30,15 +30,11 @@
 #include <wayland-server.h>
 #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 c929ca0..c61598b 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 66b33aa..f28a34d 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]