Skip to main content

Module placement

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 moving touches none of others, 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 moving out 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 moving onto nearby edges of others: 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 within threshold.