compositor: Allow attaching null buffer

Attaching a null buffer is allowed and takes the surface back to the
unattached state it starts in.
This commit is contained in:
Kristian Høgsberg 2012-01-30 09:10:14 -05:00
parent c03f96b5b0
commit ec4db94e9c
1 changed files with 15 additions and 5 deletions

View File

@ -390,11 +390,13 @@ destroy_surface(struct wl_resource *resource)
struct weston_surface, surface.resource);
struct weston_compositor *compositor = surface->compositor;
weston_surface_damage_below(surface);
weston_surface_flush_damage(surface);
if (surface->output) {
weston_surface_damage_below(surface);
weston_surface_flush_damage(surface);
wl_list_remove(&surface->link);
weston_compositor_repick(compositor);
wl_list_remove(&surface->link);
weston_compositor_repick(compositor);
}
if (surface->saved_texture == 0)
glDeleteTextures(1, &surface->texture);
@ -996,7 +998,7 @@ surface_attach(struct wl_client *client,
{
struct weston_surface *es = resource->data;
struct weston_shell *shell = es->compositor->shell;
struct wl_buffer *buffer = buffer_resource->data;
struct wl_buffer *buffer;
weston_surface_damage_below(es);
@ -1005,6 +1007,14 @@ surface_attach(struct wl_client *client,
wl_list_remove(&es->buffer_destroy_listener.link);
}
if (!buffer_resource && es->output) {
wl_list_remove(&es->link);
es->visual = WESTON_NONE_VISUAL;
es->output = NULL;
return;
}
buffer = buffer_resource->data;
buffer->busy_count++;
es->buffer = buffer;
wl_list_insert(es->buffer->resource.destroy_listener_list.prev,