Pure-function geometry helpers: zone clamping, overlap resolution, per-window minimum-size enforcement, overlay-coordinate projection, and the canonical rect-to-JSON encoder.
Pure-function corrections shared by the snap engine and the autotile engine: clamp to screen, eliminate overlaps, grow zones to respect window minimum sizes, project geometry into an overlay window's local coordinate system.
Input rects in, output rects out, with no Qt objects, no signals, and no allocation beyond the result vector. Headless geometry tests link the lib without GUI infrastructure.
| Type | Purpose |
|---|---|
PhosphorGeometry::availableAreaToOverlayCoordinates | Project an "available-area" rect into an overlay window's coords |
PhosphorGeometry::snapToRect | QRectF → QRect with consistent rounding |
PhosphorGeometry::enforceMinSizes | Grow zones to fit per-window minimum sizes by stealing surplus from neighbours, then resolve overlap |
PhosphorGeometry::clampZonesToScreen | Position-only clamp that shifts zones so each window's effective rect stays on screen, sizes preserved |
PhosphorGeometry::removeRectOverlaps | Resolve residual overlap between zones (used after min-size growth) |
PhosphorGeometry::rectToJson | Canonical rect-string format for D-Bus + JSON roundtrip |
PhosphorGeometry::JsonKeys | Key constants for the rect-JSON encoder |
clampZonesToScreen only shifts and never resizes. enforceMinSizes is the one path allowed to grow or shrink. They run in that order: first grow to fit minimums, then position-clamp anything still off-screen. For overlap-tolerant algorithms (Deck, Stair, Cascade, Monocle, Paper, Spread, horizontal-deck) enforceMinSizes is skipped, because neighbour stealing would destroy intentional overlap, and the position clamp is the only safe correction.enforceMinSizes and clampZonesToScreen both accept a minSizes vector that may be shorter than zones (or empty for enforceMinSizes). Missing entries are treated as no-minimum, and extras are ignored.QtCore