Module placement
Expand description
Pure geometry for arranging displays by dragging: edge snapping, overlap
resolution and keeping the desktop one connected area. Everything is in
desktop coordinates (the units OutputConfig::x/y are stored in), so
the rules are testable without a canvas.
Structs§
- Placement
- One display’s rectangle on the shared desktop plane.
Functions§
- attach
- If
movingtouches none ofothers, slide it to the nearest one until their edges meet: a display floating apart would leave a stretch of desktop the pointer cannot reach. - resolve_
collisions - Move
movingout of every display it overlaps, each time along the shortest way out that does not land on another display. - settle
- Where a dropped display settles: snapped to nearby edges, clear of every other display, and touching at least one of them.
- snap
- Pull
movingonto nearby edges ofothers: its left or right edge onto another display’s left or right edge, and likewise top and bottom. Each axis snaps independently to the closest edge withinthreshold.