aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2024-01-17 18:50:47 +0300
committerSimon Ser <contact@emersion.fr>2024-01-17 16:54:37 +0100
commit8d1b0cecd9cf4ef4254c9453c7d6d9649d0c7717 (patch)
treee26b23c25befc15d6d6c5a24850b95029aa250be
parent904d256581c4d2f6b2b08cd0ef84966bb8a0befd (diff)
layer-shell: wait for an initial commit before configuring
-rw-r--r--sway/desktop/layer_shell.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 1da4c61a..d493fb39 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -324,10 +324,15 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
struct wlr_output *wlr_output = layer_surface->output;
sway_assert(wlr_output, "wlr_layer_surface_v1 has null output");
struct sway_output *output = wlr_output->data;
+
+ if (layer_surface->initial_commit) {
+ surface_enter_output(layer_surface->surface, output);
+ }
+
struct wlr_box old_extent = layer->extent;
bool layer_changed = false;
- if (layer_surface->current.committed != 0
+ if (layer_surface->initial_commit || layer_surface->current.committed != 0
|| layer->mapped != layer_surface->surface->mapped) {
layer->mapped = layer_surface->surface->mapped;
layer_changed = layer->layer != layer_surface->current.layer;
@@ -708,13 +713,4 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
wl_list_insert(&output->layers[layer_surface->pending.layer],
&sway_layer->link);
-
- surface_enter_output(layer_surface->surface, output);
-
- // Temporarily set the layer's current state to pending
- // So that we can easily arrange it
- struct wlr_layer_surface_v1_state old_state = layer_surface->current;
- layer_surface->current = layer_surface->pending;
- arrange_layers(output);
- layer_surface->current = old_state;
}