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>
This commit is contained in:
Robert Bragg 2012-01-09 19:14:09 +00:00 committed by Neil Roberts
parent 862eebceb6
commit 83b94ec27d
2 changed files with 15 additions and 1 deletions

View File

@ -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? */

View File

@ -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);