commit 0979429
Michael Forney
·
2014-01-22 01:58:53 +0000 UTC
parent 03ba9f6
Remove view remove function
4 files changed,
+17,
-21
+16,
-10
1@@ -466,15 +466,6 @@ static bool update(struct swc_view * view)
2 return true;
3 }
4
5-static void remove_(struct swc_view * base)
6-{
7- struct view * view = (void *) base;
8-
9- swc_compositor_surface_hide(view->surface);
10- pixman_region32_fini(&view->clip);
11- free(view);
12-}
13-
14 static bool attach(struct swc_view * base, struct swc_buffer * buffer)
15 {
16 struct view * view = (void *) base;
17@@ -514,7 +505,6 @@ const static struct swc_view_impl view_impl = {
18 .attach = &attach,
19 .move = &move,
20 .resize = &resize,
21- .remove = &remove_,
22 };
23
24 static void handle_view_event(struct wl_listener * listener, void * data)
25@@ -577,6 +567,22 @@ bool swc_compositor_add_surface(struct swc_surface * surface)
26 return true;
27 }
28
29+bool swc_compositor_remove_surface(struct swc_surface * surface)
30+{
31+ struct view * view = (void *) surface->view;
32+
33+ if (view->base.impl != &view_impl)
34+ return false;
35+
36+ swc_compositor_surface_hide(view->surface);
37+ swc_surface_set_view(view->surface, NULL);
38+ swc_view_finalize(&view->base);
39+ pixman_region32_fini(&view->clip);
40+ free(view);
41+
42+ return true;
43+}
44+
45 void swc_compositor_surface_show(struct swc_surface * surface)
46 {
47 struct view * view = (void *) surface->view;
+0,
-7
1@@ -280,9 +280,6 @@ static void surface_destroy(struct wl_resource * resource)
2 {
3 struct swc_surface * surface = wl_resource_get_user_data(resource);
4
5- if (surface->view && surface->view->impl->remove)
6- surface->view->impl->remove(surface->view);
7-
8 /* Finish the surface. */
9 state_finish(&surface->state);
10 state_finish(&surface->pending.state);
11@@ -403,11 +400,7 @@ void swc_surface_set_view(struct swc_surface * surface, struct swc_view * view)
12 return;
13
14 if (surface->view)
15- {
16- if (surface->view->impl->remove)
17- surface->view->impl->remove(surface->view);
18 wl_list_remove(&surface->view_listener.link);
19- }
20
21 surface->view = view;
22
+0,
-3
1@@ -83,9 +83,6 @@ struct swc_view_impl
2 bool (* move)(struct swc_view * view, int32_t x, int32_t y);
3
4 void (* resize)(struct swc_view * view);
5-
6- /* Called when a source is removed from the view. */
7- void (* remove)(struct swc_view * view);
8 };
9
10 void swc_view_initialize(struct swc_view * view,
+1,
-1
1@@ -137,7 +137,7 @@ void swc_window_finalize(struct swc_window * window)
2 DEBUG("Finalizing window, %p\n", window);
3
4 swc_send_event(&window->event_signal, SWC_WINDOW_DESTROYED, NULL);
5- swc_surface_set_view(INTERNAL(window)->surface, NULL);
6+ swc_compositor_remove_surface(INTERNAL(window)->surface);
7 INTERNAL(window)->surface->window = NULL;
8 }
9