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