[clutter/wip/wayland: 25/45] wayland-surface: Add cogl-texture property



commit 678359558712a1b07d3fac8dd8850d0f801f0289
Author: Robert Bragg <robert linux intel com>
Date:   Tue Jan 10 22:39:53 2012 +0000

    wayland-surface: Add cogl-texture property
    
    This adds a "cogl-texture" gobject property so that a compositor may
    listen for notifications of changes to the texture used to paint.

 clutter/wayland/clutter-wayland-surface.c |   34 +++++++++++++++++++++++------
 clutter/wayland/clutter-wayland-surface.h |    1 +
 2 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c
index 3f1c28e..3be3274 100644
--- a/clutter/wayland/clutter-wayland-surface.c
+++ b/clutter/wayland/clutter-wayland-surface.c
@@ -55,9 +55,13 @@ enum
 {
   PROP_SURFACE = 1,
   PROP_SURFACE_WIDTH,
-  PROP_SURFACE_HEIGHT
+  PROP_SURFACE_HEIGHT,
+  PROP_COGL_TEXTURE,
+  PROP_LAST
 };
 
+static GParamSpec *obj_props[PROP_LAST];
+
 #if 0
 enum
 {
@@ -204,12 +208,12 @@ set_size (ClutterWaylandSurface *self,
   if (priv->width != width)
     {
       priv->width = width;
-      g_object_notify (G_OBJECT (self), "surface-width");
+      g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_WIDTH]);
     }
   if (priv->height != height)
     {
       priv->height = height;
-      g_object_notify (G_OBJECT (self), "surface-height");
+      g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE_HEIGHT]);
     }
 
   clutter_actor_set_size (CLUTTER_ACTOR (self), priv->width, priv->height);
@@ -249,7 +253,7 @@ clutter_wayland_surface_set_surface (ClutterWaylandSurface *self,
 
   /* XXX: should we freeze/thaw notifications? */
 
-  g_object_notify (G_OBJECT (self), "surface");
+  g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SURFACE]);
 
   /* We have to wait until the next attach event to find out the surface
    * geometry... */
@@ -417,7 +421,7 @@ clutter_wayland_surface_class_init (ClutterWaylandSurfaceClass *klass)
 			        P_("The underlying wayland surface"),
                                 CLUTTER_PARAM_READWRITE|
                                 G_PARAM_CONSTRUCT_ONLY);
-
+  obj_props[PROP_SURFACE] = pspec;
   g_object_class_install_property (object_class, PROP_SURFACE, pspec);
 
   pspec = g_param_spec_uint ("surface-width",
@@ -426,7 +430,7 @@ clutter_wayland_surface_class_init (ClutterWaylandSurfaceClass *klass)
                              0, G_MAXUINT,
                              0,
                              G_PARAM_READABLE);
-
+  obj_props[PROP_SURFACE_WIDTH] = pspec;
   g_object_class_install_property (object_class, PROP_SURFACE_WIDTH, pspec);
 
   pspec = g_param_spec_uint ("surface-height",
@@ -435,8 +439,16 @@ clutter_wayland_surface_class_init (ClutterWaylandSurfaceClass *klass)
                              0, G_MAXUINT,
                              0,
                              G_PARAM_READABLE);
-
+  obj_props[PROP_SURFACE_HEIGHT] = pspec;
   g_object_class_install_property (object_class, PROP_SURFACE_HEIGHT, pspec);
+
+  pspec = g_param_spec_boxed ("cogl-texture",
+                              P_("Cogl Texture"),
+                              P_("The underlying Cogl texture handle used to draw this actor"),
+                              COGL_TYPE_HANDLE,
+                              CLUTTER_PARAM_READWRITE);
+  obj_props[PROP_COGL_TEXTURE] = pspec;
+  g_object_class_install_property (gobject_class, PROP_COGL_TEXTURE, pspec);
 }
 
 /**
@@ -497,6 +509,8 @@ clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self,
 
   clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
 
+  g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_COGL_TEXTURE]);
+
   if (!priv->buffer)
     return FALSE;
 
@@ -576,3 +590,9 @@ clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self,
 
   clutter_wayland_surface_queue_damage_redraw (self, x, y, width, height);
 }
+
+CoglTexture *
+clutter_wayland_surface_get_cogl_texture (ClutterWaylandSurface *self)
+{
+  return COGL_TEXTURE (self->priv->buffer);
+}
diff --git a/clutter/wayland/clutter-wayland-surface.h b/clutter/wayland/clutter-wayland-surface.h
index 3786b54..54e4572 100644
--- a/clutter/wayland/clutter-wayland-surface.h
+++ b/clutter/wayland/clutter-wayland-surface.h
@@ -91,6 +91,7 @@ void          clutter_wayland_surface_damage_buffer     (ClutterWaylandSurface *
                                                          gint32 y,
                                                          gint32 width,
                                                          gint32 height);
+CoglTexture  *clutter_wayland_surface_get_cogl_texture  (ClutterWaylandSurface *self);
 
 G_END_DECLS
 



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