summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-01-09 19:14:09 +0000
committerNeil Roberts <neil@linux.intel.com>2012-03-01 11:41:51 +0000
commit83b94ec27d3073cbfaec92e9f1b4c7568081d568 (patch)
tree5e0940c1c59fdd4dd12874ff773b3c5919adb0dc
parent862eebceb6f0a3faa407e953e69eeb9ccc133036 (diff)
downloadclutter-83b94ec27d3073cbfaec92e9f1b4c7568081d568.tar.gz
wayland-surface: Make _set_surface api public
This exposes a clutter_wayland_surface_set_surface() function. The implementation ignores requests to re-set the same surface and since now has code to cleanup old surface state before setting the new surface. (previously the surface was construct only so this wasn't necessary) Reviewed-by: Neil Roberts <neil@linux.intel.com> Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
-rw-r--r--clutter/wayland/clutter-wayland-surface.c14
-rw-r--r--clutter/wayland/clutter-wayland-surface.h2
2 files changed, 15 insertions, 1 deletions
diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c
index 9a163cd4c..338812625 100644
--- a/clutter/wayland/clutter-wayland-surface.c
+++ b/clutter/wayland/clutter-wayland-surface.c
@@ -223,7 +223,19 @@ clutter_wayland_surface_set_surface (ClutterWaylandSurface *self,
priv = self->priv;
- g_return_if_fail (priv->surface == NULL);
+ if (priv->surface == surface)
+ return;
+
+ if (priv->surface)
+ {
+ free_pipeline (self);
+ free_surface_buffers (self);
+ clutter_wayland_surface_queue_damage_redraw (self,
+ 0, 0,
+ priv->width,
+ priv->height);
+ }
+
priv->surface = surface;
/* XXX: should we freeze/thaw notifications? */
diff --git a/clutter/wayland/clutter-wayland-surface.h b/clutter/wayland/clutter-wayland-surface.h
index 187ca80dd..d06eb7367 100644
--- a/clutter/wayland/clutter-wayland-surface.h
+++ b/clutter/wayland/clutter-wayland-surface.h
@@ -79,6 +79,8 @@ struct _ClutterWaylandSurfaceClass
GType clutter_wayland_surface_get_type (void) G_GNUC_CONST;
ClutterActor *clutter_wayland_surface_new (struct wl_surface *surface);
+void clutter_wayland_surface_set_surface (ClutterWaylandSurface *self,
+ struct wl_surface *surface);
gboolean clutter_wayland_surface_attach_buffer (ClutterWaylandSurface *self,
struct wl_buffer *buffer,
GError **error);