Skip to content

util: introduce rectangle packing helper

Kirill Primak requested to merge vyivel/wlroots:rectpack into master

This helper allows to pack rectangles in such a way that they don't overlap while wasting as little space as possible, which can be used to configure layer surfaces in a more intelligent way compared to what most compositors currently do.

This is especially important with layer-shell v5 which introduces set_exclusive_edge; ref !4713 (merged).

TODO: the current wlr_layer_surface_v1 helper has suboptimal behavior if the surface responds to a configure with a smaller size than requested. For correct results, the position needs to be adjusted to move the surface closer to the desired anchor point.

Examples

See https://codeberg.org/vyivel/layercheck.

maximize-trap.sh

Before:

image

After:

image

squares.sh

Before:

image

After:

image


Sway patch: https://github.com/swaywm/sway/pull/8274

Edited by Kirill Primak

Merge request reports

Loading