mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-06 23:44:58 +00:00
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>
This commit is contained in:
parent
9c764df043
commit
f8486c33b4
|
@ -1736,6 +1736,7 @@ weston_view_unmap(struct weston_view *view)
|
|||
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 @@ weston_surface_unmap(struct weston_surface *surface)
|
|||
{
|
||||
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_list_add_subsurface_view(struct weston_compositor *compositor,
|
|||
|
||||
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 @@ subsurface_get_label(struct weston_surface *surface, char *buf, size_t len)
|
|||
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 @@ subsurface_configure(struct weston_surface *surface, int32_t dx, int32_t dy)
|
|||
* 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 @@ subsurface_configure(struct weston_surface *surface, int32_t dx, int32_t dy)
|
|||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -966,6 +966,8 @@ struct weston_view {
|
|||
|
||||
/* Per-surface Presentation feedback flags, controlled by backend. */
|
||||
uint32_t psf_flags;
|
||||
|
||||
bool is_mapped;
|
||||
};
|
||||
|
||||
struct weston_surface_state {
|
||||
|
@ -1084,6 +1086,8 @@ struct weston_surface {
|
|||
const char *role_name;
|
||||
|
||||
struct weston_timeline_object timeline;
|
||||
|
||||
bool is_mapped;
|
||||
};
|
||||
|
||||
struct weston_subsurface {
|
||||
|
|
|
@ -421,6 +421,8 @@ drag_surface_configure(struct weston_drag *drag,
|
|||
weston_layer_entry_insert(list, &drag->icon->layer_link);
|
||||
weston_view_update_transform(drag->icon);
|
||||
pixman_region32_clear(&es->pending.input);
|
||||
es->is_mapped = true;
|
||||
drag->icon->is_mapped = true;
|
||||
}
|
||||
|
||||
drag->dx += sx;
|
||||
|
|
|
@ -1935,6 +1935,8 @@ pointer_cursor_surface_configure(struct weston_surface *es,
|
|||
weston_layer_entry_insert(&es->compositor->cursor_layer.view_list,
|
||||
&pointer->sprite->layer_link);
|
||||
weston_view_update_transform(pointer->sprite);
|
||||
es->is_mapped = true;
|
||||
pointer->sprite->is_mapped = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue