[clutter/wip/wayland: 13/45] wayland-surface: Make _set_surface api public



commit 9b23d8ee0020e55c31831a1336562efb37c5e524
Author: Robert Bragg <robert linux intel com>
Date:   Mon Jan 9 19:14:09 2012 +0000

    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)

 clutter/wayland/clutter-wayland-surface.c |   14 +++++++++++++-
 clutter/wayland/clutter-wayland-surface.h |    2 ++
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c
index 9a163cd..3388126 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 187ca80..d06eb73 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);



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