commit dc33892
Michael Forney
·
2014-11-29 19:33:53 +0000 UTC
parent 7426b13
compositor: Include hidden views in the list of views Otherwise, if we want to show a window A that has a pending size change above another window B, but we wait until we get the new buffer before showing it, we could run into the case where window B was hidden before we actually try to show window A. So, rather than constantly inserting/removing from the compositor's list of views, just keep every view in that list, and skip over the ones that are not visible.
1 files changed,
+10,
-4
+10,
-4
1@@ -121,7 +121,7 @@ static void handle_screen_frame(struct view_handler * handler, uint32_t time)
2
3 wl_list_for_each(view, &compositor.views, link)
4 {
5- if (view->base.screens & target->mask)
6+ if (view->visible && view->base.screens & target->mask)
7 view_frame(&view->base, time);
8 }
9
10@@ -250,7 +250,7 @@ static void renderer_repaint(struct target * target,
11
12 wl_list_for_each_reverse(view, views, link)
13 {
14- if (view->base.screens & target->mask)
15+ if (view->visible && view->base.screens & target->mask)
16 repaint_view(target, view, damage);
17 }
18
19@@ -483,6 +483,7 @@ struct compositor_view * swc_compositor_create_view
20 wl_list_init(&view->children);
21 wl_signal_init(&view->destroy_signal);
22 swc_surface_set_view(surface, &view->base);
23+ wl_list_insert(&compositor.views, &view->link);
24
25 return view;
26 }
27@@ -494,6 +495,7 @@ void compositor_view_destroy(struct compositor_view * view)
28 swc_surface_set_view(view->surface, NULL);
29 view_finalize(&view->base);
30 pixman_region32_fini(&view->clip);
31+ wl_list_remove(&view->link);
32
33 if (view->parent)
34 wl_list_remove(&view->child_link);
35@@ -537,7 +539,6 @@ void compositor_view_show(struct compositor_view * view)
36
37 damage_view(view);
38 update(&view->base);
39- wl_list_insert(&compositor.views, &view->link);
40
41 wl_list_for_each(child, &view->children, child_link)
42 compositor_view_show(child);
43@@ -554,7 +555,6 @@ void compositor_view_hide(struct compositor_view * view)
44 update(&view->base);
45 damage_below_view(view);
46
47- wl_list_remove(&view->link);
48 view_set_screens(&view->base, 0);
49 view->visible = false;
50
51@@ -604,6 +604,9 @@ static void calculate_damage()
52 /* Go through views top-down to calculate clipping regions. */
53 wl_list_for_each(view, &compositor.views, link)
54 {
55+ if (!view->visible)
56+ continue;
57+
58 /* Clip the surface by the opaque region covering it. */
59 pixman_region32_copy(&view->clip, &compositor.opaque);
60
61@@ -740,6 +743,9 @@ bool handle_motion(struct pointer_handler * handler, uint32_t time,
62
63 wl_list_for_each(view, &compositor.views, link)
64 {
65+ if (!view->visible)
66+ continue;
67+
68 if (swc_rectangle_contains_point(&view->base.geometry, x, y)
69 && pixman_region32_contains_point(&view->surface->state.input,
70 x - view->base.geometry.x,