swaywm / swaybg

Wallpaper tool for Wayland compositors
MIT License
490 stars 31 forks source link

Only render a new frame when the buffer size changes #30

Closed mstoeckl closed 2 years ago

mstoeckl commented 2 years ago

This change avoids rendering new buffers unless required.

The mechanism of storing the last committed width/height/scale ensures that swaybg will avoid redrawing the output buffer if it can do so; this works even for the case where the output scale changes, but the buffer size (scale * configured size) does not.

This also avoids redrawing the background when the compositor resends the zwlr_layer_surface_v1::configure event with the same recommended size as before; recent Sway tends to do this whenever a new layer shell surface is added.