diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2024-01-17 18:50:47 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-01-17 16:54:37 +0100 |
commit | 8d1b0cecd9cf4ef4254c9453c7d6d9649d0c7717 (patch) | |
tree | e26b23c25befc15d6d6c5a24850b95029aa250be | |
parent | layer-shell: don't try to unmap on destroy (diff) | |
download | sway-8d1b0cecd9cf4ef4254c9453c7d6d9649d0c7717.tar.gz sway-8d1b0cecd9cf4ef4254c9453c7d6d9649d0c7717.tar.zst sway-8d1b0cecd9cf4ef4254c9453c7d6d9649d0c7717.zip |
layer-shell: wait for an initial commit before configuring
-rw-r--r-- | sway/desktop/layer_shell.c | 16 |
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) { | |||
324 | struct wlr_output *wlr_output = layer_surface->output; | 324 | struct wlr_output *wlr_output = layer_surface->output; |
325 | sway_assert(wlr_output, "wlr_layer_surface_v1 has null output"); | 325 | sway_assert(wlr_output, "wlr_layer_surface_v1 has null output"); |
326 | struct sway_output *output = wlr_output->data; | 326 | struct sway_output *output = wlr_output->data; |
327 | |||
328 | if (layer_surface->initial_commit) { | ||
329 | surface_enter_output(layer_surface->surface, output); | ||
330 | } | ||
331 | |||
327 | struct wlr_box old_extent = layer->extent; | 332 | struct wlr_box old_extent = layer->extent; |
328 | 333 | ||
329 | bool layer_changed = false; | 334 | bool layer_changed = false; |
330 | if (layer_surface->current.committed != 0 | 335 | if (layer_surface->initial_commit || layer_surface->current.committed != 0 |
331 | || layer->mapped != layer_surface->surface->mapped) { | 336 | || layer->mapped != layer_surface->surface->mapped) { |
332 | layer->mapped = layer_surface->surface->mapped; | 337 | layer->mapped = layer_surface->surface->mapped; |
333 | layer_changed = layer->layer != layer_surface->current.layer; | 338 | layer_changed = layer->layer != layer_surface->current.layer; |
@@ -708,13 +713,4 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
708 | 713 | ||
709 | wl_list_insert(&output->layers[layer_surface->pending.layer], | 714 | wl_list_insert(&output->layers[layer_surface->pending.layer], |
710 | &sway_layer->link); | 715 | &sway_layer->link); |
711 | |||
712 | surface_enter_output(layer_surface->surface, output); | ||
713 | |||
714 | // Temporarily set the layer's current state to pending | ||
715 | // So that we can easily arrange it | ||
716 | struct wlr_layer_surface_v1_state old_state = layer_surface->current; | ||
717 | layer_surface->current = layer_surface->pending; | ||
718 | arrange_layers(output); | ||
719 | layer_surface->current = old_state; | ||
720 | } | 716 | } |