compositor: Untangle surface/view is_mapped from output assignments
Currently, weston assumes a surface/view is mapped if
it has an output assigned. In a zero outputs scenario,
this isn't really desirable.
This patch introduces a new flag to weston_surface and
weston_view, which has to be set manually to indicate
that a surface/view is mapped.
v2:
- Remove usage of new flags from
weston_{view,surface}_is_mapped at this point. They
will be added after all the implicit mappings have
been introduced
- Unmap a surface before unmapping a view so the input
foci is cleaned up properly
- Remove implicit view mapping from view_list_add
- Cosmetic fixes
v3:
- Rebased to apply on git master
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 0c405ac..5abef52 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -1736,6 +1736,7 @@
weston_view_damage_below(view);
view->output = NULL;
view->plane = NULL;
+ view->is_mapped = false;
weston_layer_entry_remove(&view->layer_link);
wl_list_remove(&view->link);
wl_list_init(&view->link);
@@ -1765,6 +1766,7 @@
{
struct weston_view *view;
+ surface->is_mapped = false;
wl_list_for_each(view, &surface->views, surface_link)
weston_view_unmap(view);
surface->output = NULL;
@@ -2129,6 +2131,7 @@
view->parent_view = parent;
weston_view_update_transform(view);
+ view->is_mapped = true;
if (wl_list_empty(&sub->surface->subsurface_list)) {
wl_list_insert(compositor->view_list.prev, &view->link);
@@ -3242,7 +3245,6 @@
static void
subsurface_configure(struct weston_surface *surface, int32_t dx, int32_t dy)
{
- struct weston_compositor *compositor = surface->compositor;
struct weston_view *view;
wl_list_for_each(view, &surface->views, surface_link)
@@ -3254,8 +3256,9 @@
* mapped, parent is not in a visible layer, so this sub-surface
* will not be drawn either.
*/
+
if (!weston_surface_is_mapped(surface)) {
- struct weston_output *output;
+ surface->is_mapped = true;
/* Cannot call weston_view_update_transform(),
* because that would call it also for the parent surface,
@@ -3263,17 +3266,11 @@
* inconsistent state, where the window could never be
* mapped.
*
- * Instead just assign any output, to make
+ * Instead just force the is_mapped flag on, to make
* weston_surface_is_mapped() return true, so that when the
* parent surface does get mapped, this one will get
* included, too. See view_list_add().
*/
- assert(!wl_list_empty(&compositor->output_list));
- output = container_of(compositor->output_list.next,
- struct weston_output, link);
-
- surface->output = output;
- weston_surface_update_output_mask(surface, 1u << output->id);
}
}