From 51d39c0eb673e09ac685b72407d7970575e3892b Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 21 Mar 2024 12:14:08 +0200 Subject: layout, shell: Use implicit layer move to add views to layers This afffects the background/panels and black curtain installment, with regular activation still using the older approach. Bug-AGL: SPEC-5096, SPEC-5061 Signed-off-by: Marius Vlad Change-Id: I7ba13c9ff7291c9b4f3b299c52fdf753a8d83081 --- src/desktop.c | 2 +- src/layout.c | 18 +++++++++--------- src/shell.c | 25 ++++++++----------------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/desktop.c b/src/desktop.c index 8554b06..1d60bf1 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -318,7 +318,7 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata) output->active->view->is_mapped = false; output->active->view->surface->is_mapped = false; - weston_layer_entry_remove(&output->active->view->layer_link); + weston_view_move_to_layer(output->active->view, NULL); output->active = NULL; } diff --git a/src/layout.c b/src/layout.c index 4c4ae6a..5d364ee 100644 --- a/src/layout.c +++ b/src/layout.c @@ -69,6 +69,8 @@ ivi_background_init(struct ivi_compositor *ivi, struct ivi_output *output) struct weston_output *woutput = output->output; struct ivi_surface *bg = output->background; struct weston_view *view; + struct weston_surface *wsurface = + weston_desktop_surface_get_surface(bg->dsurface); if (!bg) { weston_log("WARNING: Output does not have a background\n"); @@ -78,17 +80,15 @@ ivi_background_init(struct ivi_compositor *ivi, struct ivi_output *output) assert(bg->role == IVI_SURFACE_ROLE_BACKGROUND); view = bg->view; + weston_surface_map(wsurface); weston_view_set_output(view, woutput); weston_view_set_position(view, woutput->pos); + weston_view_move_to_layer(view, &ivi->background.view_list); weston_log("(background) position view %p, x %f, y %f, on output %s\n", view, woutput->pos.c.x, woutput->pos.c.y, output->name); - view->is_mapped = true; - view->surface->is_mapped = true; - - weston_layer_entry_insert(&ivi->background.view_list, &view->layer_link); } static void @@ -100,6 +100,8 @@ ivi_panel_init(struct ivi_compositor *ivi, struct ivi_output *output, struct weston_view *view; struct weston_geometry geom; struct weston_coord_global pos = woutput->pos; + struct weston_surface *wsurface = + weston_desktop_surface_get_surface(panel->dsurface); if (!panel) return; @@ -137,16 +139,14 @@ ivi_panel_init(struct ivi_compositor *ivi, struct ivi_output *output, weston_view_set_output(view, woutput); weston_view_set_position(view, pos); + weston_surface_map(wsurface); + weston_view_move_to_layer(view, &ivi->panel.view_list); + weston_log("(panel) edge %d position view %p, x %f, y %f\n", panel->panel.edge, view, pos.c.x, pos.c.y); - view->is_mapped = true; - view->surface->is_mapped = true; - weston_log("panel type %d inited on output %s\n", panel->panel.edge, output->name); - - weston_layer_entry_insert(&ivi->panel.view_list, &view->layer_link); } /* diff --git a/src/shell.c b/src/shell.c index e9898a4..c29d89e 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1103,6 +1103,7 @@ void remove_black_curtain(struct ivi_output *output) { struct weston_view *view; + struct weston_surface *wsurface; if ((!output && !output->fullscreen_view.fs && @@ -1113,17 +1114,13 @@ remove_black_curtain(struct ivi_output *output) } view = output->fullscreen_view.fs->view; + wsurface = view->surface; assert(view->is_mapped == true || view->surface->is_mapped == true); - view->is_mapped = false; - view->surface->is_mapped = false; - - weston_layer_entry_remove(&view->layer_link); - weston_view_update_transform(view); - - weston_view_damage_below(view); + weston_surface_unmap(wsurface); + weston_view_move_to_layer(view, NULL); weston_log("Removed black curtain from output %s\n", output->output->name); } @@ -1131,6 +1128,7 @@ void insert_black_curtain(struct ivi_output *output) { struct weston_view *view; + struct weston_surface *wsurface; if ((!output && !output->fullscreen_view.fs && @@ -1141,19 +1139,12 @@ insert_black_curtain(struct ivi_output *output) } view = output->fullscreen_view.fs->view; + wsurface = view->surface; if (view->is_mapped || view->surface->is_mapped) return; - weston_layer_entry_remove(&view->layer_link); - weston_layer_entry_insert(&output->ivi->fullscreen.view_list, - &view->layer_link); - - view->is_mapped = true; - view->surface->is_mapped = true; - - weston_view_update_transform(view); - weston_view_damage_below(view); - + weston_surface_map(wsurface); + weston_view_move_to_layer(view, &output->ivi->fullscreen.view_list); weston_log("Added black curtain to output %s\n", output->output->name); } -- cgit 1.2.3-korg