layout, shell: Use implicit layer move to add views to layers 91/29791/1
authorMarius Vlad <marius.vlad@collabora.com>
Thu, 21 Mar 2024 10:14:08 +0000 (12:14 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Thu, 28 Mar 2024 13:37:20 +0000 (15:37 +0200)
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 <marius.vlad@collabora.com>
Change-Id: If8f8272fa29e02535eb5751a3119eb6deba0c3ae

src/desktop.c
src/layout.c
src/shell.c

index 8554b06..1d60bf1 100644 (file)
@@ -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;
        }
 
index 4c4ae6a..5d364ee 100644 (file)
@@ -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);
 }
 
 /*
index e9898a4..c29d89e 100644 (file)
@@ -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);
 }