]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Fix usable area calculation
authorConsus <consus@ftml.net>
Tue, 28 Jun 2022 19:47:48 +0000 (22:47 +0300)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 28 Jun 2022 20:38:42 +0000 (21:38 +0100)
Currently if a surface with exclusive zone is created prior to regular
surfaces, the size of the exclusize zone does not affect the usable area
for regular surfaces. This for example results in notifications being
rendered over the statusbar.

This commit fixes the issue by handling the surfaces with exclusive
zones first.

Fixes #420.

src/layers.c

index d36e11a50dd3b8c7d975f109ff1cf7b7c6b1c9da..8a03d3cb91a0a2b55c7ca5a27c63cb41ecb43dad 100644 (file)
@@ -37,11 +37,29 @@ layers_arrange(struct output *output)
        int nr_layers = sizeof(output->layers) / sizeof(output->layers[0]);
        for (int i = 0; i < nr_layers; i++) {
                struct lab_layer_surface *lab_layer_surface;
+
+               /*
+                * First we go over the list of surfaces that have
+                * exclusive_zone set (e.g. statusbars) because we have to
+                * determine the usable area before processing regular layouts.
+                */
+               wl_list_for_each(lab_layer_surface, &output->layers[i], link) {
+                       struct wlr_scene_layer_surface_v1 *scene_layer_surface =
+                               lab_layer_surface->scene_layer_surface;
+                       if (scene_layer_surface->layer_surface->current.exclusive_zone) {
+                               wlr_scene_layer_surface_v1_configure(
+                                       scene_layer_surface, &full_area, &usable_area);
+                       }
+               }
+
+               /* Now we process regular layouts */
                wl_list_for_each(lab_layer_surface, &output->layers[i], link) {
                        struct wlr_scene_layer_surface_v1 *scene_layer_surface =
                                lab_layer_surface->scene_layer_surface;
-                       wlr_scene_layer_surface_v1_configure(
-                               scene_layer_surface, &full_area, &usable_area);
+                       if (!scene_layer_surface->layer_surface->current.exclusive_zone) {
+                               wlr_scene_layer_surface_v1_configure(
+                                       scene_layer_surface, &full_area, &usable_area);
+                       }
                }
 
                wlr_scene_node_set_position(&output->layer_tree[i]->node,
@@ -350,7 +368,7 @@ new_layer_surface_notify(struct wl_listener *listener, void *data)
                return;
        }
 
-       wl_list_insert(&output->layers[layer_surface->pending.layer],
+       wl_list_insert(output->layers[layer_surface->pending.layer].prev,
                &surface->link);
        /*
         * Temporarily set the layer's current state to pending so that