diff options
author | Robert Bragg <robert@linux.intel.com> | 2012-01-10 22:39:53 +0000 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2012-03-01 11:41:51 +0000 |
commit | b89af8efa3931bb0cb5a7c5c6a01823ab5d6be78 (patch) | |
tree | 69502c82036e900d6787e5e3dffe98af3786ce6c | |
parent | 8ac2200aac44d481f2b069554e85976ad1f47372 (diff) | |
download | clutter-b89af8efa3931bb0cb5a7c5c6a01823ab5d6be78.tar.gz |
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.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
-rw-r--r-- | clutter/wayland/clutter-wayland-surface.c | 36 | ||||
-rw-r--r-- | clutter/wayland/clutter-wayland-surface.h | 1 |
2 files changed, 30 insertions, 7 deletions
diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c index 3f1c28ee8..7ba809d6a 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 (object_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,11 @@ 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) +{ + g_return_val_if_fail (CLUTTER_WAYLAND_IS_SURFACE (self), NULL); + + return COGL_TEXTURE (self->priv->buffer); +} diff --git a/clutter/wayland/clutter-wayland-surface.h b/clutter/wayland/clutter-wayland-surface.h index 3786b548c..54e457231 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 |