[PATCH 4/7] compositor: Mark all views as dirty when all outputs are gone

Armin Krezović krezovic.armin at gmail.com
Fri Jul 29 11:26:25 UTC 2016


When all outputs are gone and views were created before they
were gone, all views would have an output that points to a
destroyed object.

Instead, mark the view as dirty and set the view output to
NULL so a view gets an output assigned as soon as it gets
plugged in.

Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
---
 libweston/compositor.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index 96eeb17..4467555 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -1212,10 +1212,14 @@ get_view_layer(struct weston_view *view)
 WL_EXPORT void
 weston_view_update_transform(struct weston_view *view)
 {
+	struct weston_compositor *ec = view->surface->compositor;;
 	struct weston_view *parent = view->geometry.parent;
 	struct weston_layer *layer;
 	pixman_region32_t mask;
 
+	if (wl_list_empty(&ec->output_list))
+		return;
+
 	if (!view->transform.dirty)
 		return;
 
@@ -4085,11 +4089,6 @@ weston_output_destroy(struct weston_output *output)
 
 	output->destroying = 1;
 
-	wl_list_for_each(view, &output->compositor->view_list, link) {
-		if (view->output_mask & (1u << output->id))
-			weston_view_assign_output(view);
-	}
-
 	wl_event_source_remove(output->repaint_timer);
 
 	weston_presentation_feedback_discard_list(&output->feedback_list);
@@ -4097,6 +4096,16 @@ weston_output_destroy(struct weston_output *output)
 	weston_compositor_reflow_outputs(output->compositor, output, output->width);
 	wl_list_remove(&output->link);
 
+	wl_list_for_each(view, &output->compositor->view_list, link) {
+		if (wl_list_empty(&output->compositor->output_list)) {
+			weston_view_geometry_dirty(view);
+			view->output = NULL;
+		}
+		else if (view->output_mask & (1u << output->id)) {
+			weston_view_assign_output(view);
+		}
+	}
+
 	wl_signal_emit(&output->compositor->output_destroyed_signal, output);
 	wl_signal_emit(&output->destroy_signal, output);
 
-- 
2.9.2



More information about the wayland-devel mailing list