]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/layers.c: calculate usable_area before positioning clients
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Wed, 6 Dec 2023 13:24:17 +0000 (14:24 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 6 Dec 2023 22:04:07 +0000 (22:04 +0000)
This ensures that the usable area is completely calculated
before non exclusive-zone clients are positioned / resized.

Fixes #1285
Reported-by: @spl237
src/layers.c

index 16a4be584b61bb35f426fc605d3f7c189e3b720d..8b58f1f104d5218fc36753882872fba9c76f3082 100644 (file)
@@ -78,16 +78,29 @@ layers_arrange(struct output *output)
                return;
        }
 
-       for (size_t i = 0; i < ARRAY_SIZE(output->layer_tree); i++) {
+       for (int i = ARRAY_SIZE(output->layer_tree) - 1; i >= 0; i--) {
                struct wlr_scene_tree *layer = output->layer_tree[i];
 
                /*
                 * Process exclusive-zone clients before non-exclusive-zone
                 * clients, so that the latter give way to the former regardless
                 * of the order in which they were launched.
+                *
+                * Also start calculating the usable_area for exclusive-zone
+                * clients from the Overlay layer down to the Background layer
+                * to ensure that higher layers have a higher preference for
+                * placement.
+                *
+                * The 'exclusive' boolean also matches -1 which means that
+                * the layershell client wants to use the full screen rather
+                * than the usable area.
                 */
-               arrange_one_layer(&full_area, &usable_area, layer, true);
-               arrange_one_layer(&full_area, &usable_area, layer, false);
+               arrange_one_layer(&full_area, &usable_area, layer, /* exclusive */ true);
+       }
+
+       for (size_t i = 0; i < ARRAY_SIZE(output->layer_tree); i++) {
+               struct wlr_scene_tree *layer = output->layer_tree[i];
+               arrange_one_layer(&full_area, &usable_area, layer, /* exclusive */ false);
 
                /* Set node position to account for output layout change */
                wlr_scene_node_set_position(&layer->node, scene_output->x,