Fix usable area calculation

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.
This commit is contained in:
Consus 2022-06-28 22:47:48 +03:00 committed by Johan Malm
parent a3d3878d28
commit ef3dbbf29a

View 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;
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);
}
}
/* 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;
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