layer-shell: don't arrange layers on each surface commit

Only arrange layer surfaces if a surface has updated its layer-shell
configuration.

References: https://github.com/swaywm/wlroots/pull/2794
This commit is contained in:
Simon Ser 2021-03-19 10:47:29 +01:00
parent 6059c744f8
commit 9e2ac25fd9

View file

@ -289,13 +289,16 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
return;
}
struct sway_output *output = wlr_output->data;
struct wlr_box old_geo = layer->geo;
arrange_layers(output);
bool geo_changed = false, layer_changed = false;
if (layer_surface->current.committed != 0) {
struct sway_output *output = wlr_output->data;
struct wlr_box old_geo = layer->geo;
arrange_layers(output);
geo_changed = memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0;
layer_changed = layer->layer != layer_surface->current.layer;
}
bool geo_changed =
memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0;
bool layer_changed = layer->layer != layer_surface->current.layer;
if (layer_changed) {
wl_list_remove(&layer->link);
wl_list_insert(&output->layers[layer_surface->current.layer],