commit 0979429e8ff983a46aa7b362b1c50907ac70981b
parent 03ba9f64d675c7b36b69d5c73eca59165c634322
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 21 Jan 2014 17:58:53 -0800
Remove view remove function
Diffstat:
4 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -466,15 +466,6 @@ static bool update(struct swc_view * view)
return true;
}
-static void remove_(struct swc_view * base)
-{
- struct view * view = (void *) base;
-
- swc_compositor_surface_hide(view->surface);
- pixman_region32_fini(&view->clip);
- free(view);
-}
-
static bool attach(struct swc_view * base, struct swc_buffer * buffer)
{
struct view * view = (void *) base;
@@ -514,7 +505,6 @@ const static struct swc_view_impl view_impl = {
.attach = &attach,
.move = &move,
.resize = &resize,
- .remove = &remove_,
};
static void handle_view_event(struct wl_listener * listener, void * data)
@@ -577,6 +567,22 @@ bool swc_compositor_add_surface(struct swc_surface * surface)
return true;
}
+bool swc_compositor_remove_surface(struct swc_surface * surface)
+{
+ struct view * view = (void *) surface->view;
+
+ if (view->base.impl != &view_impl)
+ return false;
+
+ swc_compositor_surface_hide(view->surface);
+ swc_surface_set_view(view->surface, NULL);
+ swc_view_finalize(&view->base);
+ pixman_region32_fini(&view->clip);
+ free(view);
+
+ return true;
+}
+
void swc_compositor_surface_show(struct swc_surface * surface)
{
struct view * view = (void *) surface->view;
diff --git a/libswc/surface.c b/libswc/surface.c
@@ -280,9 +280,6 @@ static void surface_destroy(struct wl_resource * resource)
{
struct swc_surface * surface = wl_resource_get_user_data(resource);
- if (surface->view && surface->view->impl->remove)
- surface->view->impl->remove(surface->view);
-
/* Finish the surface. */
state_finish(&surface->state);
state_finish(&surface->pending.state);
@@ -403,11 +400,7 @@ void swc_surface_set_view(struct swc_surface * surface, struct swc_view * view)
return;
if (surface->view)
- {
- if (surface->view->impl->remove)
- surface->view->impl->remove(surface->view);
wl_list_remove(&surface->view_listener.link);
- }
surface->view = view;
diff --git a/libswc/view.h b/libswc/view.h
@@ -83,9 +83,6 @@ struct swc_view_impl
bool (* move)(struct swc_view * view, int32_t x, int32_t y);
void (* resize)(struct swc_view * view);
-
- /* Called when a source is removed from the view. */
- void (* remove)(struct swc_view * view);
};
void swc_view_initialize(struct swc_view * view,
diff --git a/libswc/window.c b/libswc/window.c
@@ -137,7 +137,7 @@ void swc_window_finalize(struct swc_window * window)
DEBUG("Finalizing window, %p\n", window);
swc_send_event(&window->event_signal, SWC_WINDOW_DESTROYED, NULL);
- swc_surface_set_view(INTERNAL(window)->surface, NULL);
+ swc_compositor_remove_surface(INTERNAL(window)->surface);
INTERNAL(window)->surface->window = NULL;
}