compositor: Allow attaching null buffer

Attaching a null buffer is allowed and takes the surface back to the
unattached state it starts in.
dev
Kristian Høgsberg 13 years ago
parent fa1de69203
commit d1e8625df2
  1. 20
      src/compositor.c

@ -530,11 +530,13 @@ destroy_surface(struct wl_resource *resource)
struct weston_surface, surface.resource); struct weston_surface, surface.resource);
struct weston_compositor *compositor = surface->compositor; struct weston_compositor *compositor = surface->compositor;
weston_surface_damage_below(surface); if (surface->output) {
weston_surface_flush_damage(surface); weston_surface_damage_below(surface);
weston_surface_flush_damage(surface);
wl_list_remove(&surface->link); wl_list_remove(&surface->link);
weston_compositor_repick(compositor); weston_compositor_repick(compositor);
}
glDeleteTextures(1, &surface->texture); glDeleteTextures(1, &surface->texture);
@ -1075,7 +1077,7 @@ surface_attach(struct wl_client *client,
{ {
struct weston_surface *es = resource->data; struct weston_surface *es = resource->data;
struct weston_shell *shell = es->compositor->shell; struct weston_shell *shell = es->compositor->shell;
struct wl_buffer *buffer = buffer_resource->data; struct wl_buffer *buffer;
weston_surface_damage_below(es); weston_surface_damage_below(es);
@ -1084,6 +1086,14 @@ surface_attach(struct wl_client *client,
wl_list_remove(&es->buffer_destroy_listener.link); 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++; buffer->busy_count++;
es->buffer = buffer; es->buffer = buffer;
wl_list_insert(es->buffer->resource.destroy_listener_list.prev, wl_list_insert(es->buffer->resource.destroy_listener_list.prev,

Loading…
Cancel
Save