]> git.mdlowis.com Git - proto/labwc.git/commitdiff
layer-shell: fix commit handler (issue #71)
authorJohan Malm <jgm323@gmail.com>
Fri, 15 Oct 2021 18:14:07 +0000 (19:14 +0100)
committerJohan Malm <jgm323@gmail.com>
Fri, 15 Oct 2021 18:14:07 +0000 (19:14 +0100)
On commit, do not arrange layers unless the layer shell-specific state
changed or the layer was (un)mapped.

Chase swaywm/sway@5fd5d643 and swaywm/wlroots@754f40f9

include/layers.h
src/layers.c

index 5bf2f6a68fbc941ca5e28ec7093062e93b95c8b8..6ed53234739cf0836249a55df74b8c872289b583 100644 (file)
@@ -17,6 +17,7 @@ struct lab_layer_surface {
        struct wl_listener output_destroy;
 
        struct wlr_box geo;
+       bool mapped;
 };
 
 void layers_init(struct server *server);
index 2eca01c39650266129923fbe0f13e55c900f602d..b8a0727958d532c30c02993978a844365501f083 100644 (file)
@@ -250,8 +250,20 @@ surface_commit_notify(struct wl_listener *listener, void *data)
 {
        struct lab_layer_surface *layer =
                wl_container_of(listener, layer, surface_commit);
+       struct wlr_layer_surface_v1 *layer_surface = layer->layer_surface;
        struct wlr_output *wlr_output = layer->layer_surface->output;
-       arrange_layers(output_from_wlr_output(layer->server, wlr_output));
+
+       if (!wlr_output) {
+               return;
+       }
+
+       if (layer_surface->current.committed
+                       || layer->mapped != layer_surface->mapped) {
+               layer->mapped = layer_surface->mapped;
+               struct output *output =
+                       output_from_wlr_output(layer->server, wlr_output);
+               arrange_layers(output);
+       }
        damage_all_outputs(layer->server);
 }