compositor: Move unmap logic to new function weston_surface_unmap()

This commit is contained in:
Kristian Høgsberg
2012-02-17 12:43:56 -05:00
parent 12bbf81456
commit 3b5ea3bc6f
+14 -9
View File
@@ -576,6 +576,17 @@ weston_compositor_repick(struct weston_compositor *compositor)
weston_device_repick(&device->input_device, time); weston_device_repick(&device->input_device, time);
} }
static void
weston_surface_unmap(struct weston_surface *surface)
{
weston_surface_damage_below(surface);
weston_surface_flush_damage(surface);
surface->output = NULL;
wl_list_remove(&surface->link);
weston_compositor_repick(surface->compositor);
weston_compositor_schedule_repaint(surface->compositor);
}
static void static void
destroy_surface(struct wl_resource *resource) destroy_surface(struct wl_resource *resource)
{ {
@@ -584,13 +595,8 @@ 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;
if (surface->output) { if (surface->output)
weston_surface_damage_below(surface); weston_surface_unmap(surface);
weston_surface_flush_damage(surface);
wl_list_remove(&surface->link);
weston_compositor_repick(compositor);
}
if (surface->texture) if (surface->texture)
glDeleteTextures(1, &surface->texture); glDeleteTextures(1, &surface->texture);
@@ -1130,8 +1136,7 @@ surface_attach(struct wl_client *client,
} }
if (!buffer_resource && es->output) { if (!buffer_resource && es->output) {
wl_list_remove(&es->link); weston_surface_unmap(es);
es->output = NULL;
es->buffer = NULL; es->buffer = NULL;
return; return;
} }