Layer shell: Prevent infinte configure/commit loop

Check the wlr_layer_surface_v1_state.committed bitmask to see if we need
to rearrange. This is also what sway does.

Without this check, every commit request (even if only the attached buffer
changed) will lead to another configure event, which will lead to another
commit, etc.

This loop results in swaybg consuming 100% CPU.
This commit is contained in:
Raphael Robatsch 2021-11-06 19:51:17 +01:00
parent 2d9740c2fc
commit 9b406d8d33

7
dwl.c
View File

@ -150,6 +150,7 @@ typedef struct {
struct wlr_box geo;
enum zwlr_layer_shell_v1_layer layer;
bool mapped;
} LayerSurface;
typedef struct {
@ -755,6 +756,12 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
struct wlr_output *wlr_output = wlr_layer_surface->output;
Monitor *m;
if (wlr_layer_surface->current.committed == 0 &&
layersurface->mapped == wlr_layer_surface->mapped)
return;
layersurface->mapped = wlr_layer_surface->mapped;
if (!wlr_output)
return;