From 4b3e09fa7156e6aa96f8f1a177b0cd6d15aa1f5a Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 21 Jun 2022 20:07:24 +0100 Subject: [PATCH] desktop-shell: Centralise view mapping for shell_surfaces shell_surface_update_layer() is the thing which moves our views around into layers. Since we want to keep an invariant that a view is mapped if it is on a layer, and unmapped if it is not on a layer, handle mapping along with the layer moves. Signed-off-by: Daniel Stone --- desktop-shell/shell.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 958ad078..d21d2837 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -598,6 +598,7 @@ create_focus_surface(struct weston_compositor *ec, fsurf->curtain = weston_shell_utils_curtain_create(ec, &curtain_params); weston_view_set_output(fsurf->curtain->view, output); + /* XXX: can't map view without a layer! */ fsurf->curtain->view->is_mapped = true; return fsurf; @@ -1731,7 +1732,9 @@ shell_surface_update_layer(struct shell_surface *shsurf) /* Add the surface to the new layer and dirty its new region. */ weston_layer_entry_insert(new_layer_link, &shsurf->view->layer_link); + shsurf->view->is_mapped = true; weston_view_geometry_dirty(shsurf->view); + weston_view_update_transform(shsurf->view); /* XXX: unnecessary? */ weston_surface_damage(surface); shell_surface_update_child_surface_layers(shsurf); @@ -2357,18 +2360,17 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf) weston_view_set_initial_position(shsurf->view, shell); } + /* XXX: don't map without a buffer! */ + weston_surface_map(surface); + /* Surface stacking order, see also activate(). */ shell_surface_update_layer(shsurf); - weston_view_update_transform(shsurf->view); - shsurf->view->is_mapped = true; if (shsurf->state.maximized) { surface->output = shsurf->output; weston_view_set_output(shsurf->view, shsurf->output); } - weston_surface_map(surface); - if (!shell->locked) { wl_list_for_each(seat, &compositor->seat_list, link) activate(shell, shsurf->view, seat,