From 0669d4de4f225533a0559395c3ee923124123865 Mon Sep 17 00:00:00 2001 From: Alexandros Frantzis Date: Thu, 8 Sep 2022 14:05:17 +0300 Subject: [PATCH] libweston: Skip views without a layer assignment in output_mask calculations Surface views that are not assigned to a layer are not going to be rendered, and thus should not participate in determining the outputs the surface is on. There are other view properties that may determine if the view should be considered in output_mask calculations, e.g., is_mapped, but checking for this currently breaks tests. Such additional checks are left for future fixes or reworkings of the view infrastructure. Fixes #646 Signed-off-by: Alexandros Frantzis --- libweston/compositor.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 30913cbc..6cfcba25 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -1300,6 +1300,14 @@ weston_view_set_output(struct weston_view *view, struct weston_output *output) } } +static struct weston_layer * +get_view_layer(struct weston_view *view) +{ + if (view->parent_view) + return get_view_layer(view->parent_view); + return view->layer_link.layer; +} + /** Recalculate which output(s) the surface has views displayed on * * \param es The surface to remap to outputs @@ -1325,7 +1333,9 @@ weston_surface_assign_output(struct weston_surface *es) mask = 0; pixman_region32_init(®ion); wl_list_for_each(view, &es->views, surface_link) { - if (!view->output) + /* Only views that are visible on some layer participate in + * output_mask calculations. */ + if (!view->output || !get_view_layer(view)) continue; pixman_region32_intersect(®ion, &view->transform.boundingbox, @@ -1605,14 +1615,6 @@ weston_view_update_transform_enable(struct weston_view *view) return 0; } -static struct weston_layer * -get_view_layer(struct weston_view *view) -{ - if (view->parent_view) - return get_view_layer(view->parent_view); - return view->layer_link.layer; -} - WL_EXPORT void weston_view_update_transform(struct weston_view *view) {