Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorEngine::GeometryUtils Namespace Reference

Functions

PHOSPHORENGINE_EXPORT QString serializeZoneAssignments (const QVector< ZoneAssignmentEntry > &entries)
PHOSPHORENGINE_EXPORT QVector< ZoneAssignmentEntry > deserializeZoneAssignments (const QString &json, QString *errorString=nullptr)
 Parse the wire format serializeZoneAssignments produces back into entries — the two functions are the single serializer/deserializer pair for the batch resnap payload, sharing the same JsonKeys constants so the sides cannot drift.
PHOSPHORENGINE_EXPORT QRect carryRectOntoArea (const QRect &rect, const QRect &fromArea, const QRect &toArea)
 rect carried from fromArea onto toArea: its position kept relative to the area, its size shrunk only where toArea is smaller, then clamped so the whole rect fits.
PHOSPHORGEOMETRY_EXPORT QRectF availableAreaToOverlayCoordinates (const QRectF &geometry, const QRect &overlayGeometry)
PHOSPHORGEOMETRY_EXPORT void clampZonesToScreen (QVector< QRect > &zones, const QVector< QSize > &minSizes, const QRect &screen)
PHOSPHORGEOMETRY_EXPORT void enforceMinSizes (QVector< QRect > &zones, const QVector< QSize > &minSizes, int gapThreshold, int innerGap=0)
PHOSPHORGEOMETRY_EXPORT QString rectToJson (const QRect &rect)
PHOSPHORGEOMETRY_EXPORT void removeRectOverlaps (QVector< QRect > &zones, const QVector< QSize > &minSizes={}, int innerGap=0)
PHOSPHORGEOMETRY_EXPORT QRect snapToRect (const QRectF &rf)

Function Documentation

◆ availableAreaToOverlayCoordinates()

PHOSPHORGEOMETRY_EXPORT QRectF PhosphorGeometry::availableAreaToOverlayCoordinates ( const QRectF & geometry,
const QRect & overlayGeometry )

◆ carryRectOntoArea()

PHOSPHORENGINE_EXPORT QRect PhosphorEngine::GeometryUtils::carryRectOntoArea ( const QRect & rect,
const QRect & fromArea,
const QRect & toArea )

rect carried from fromArea onto toArea: its position kept relative to the area, its size shrunk only where toArea is smaller, then clamped so the whole rect fits.

An invalid fromArea starts at toArea's top-left.

◆ clampZonesToScreen()

PHOSPHORGEOMETRY_EXPORT void PhosphorGeometry::clampZonesToScreen ( QVector< QRect > & zones,
const QVector< QSize > & minSizes,
const QRect & screen )

◆ deserializeZoneAssignments()

PHOSPHORENGINE_EXPORT QVector< ZoneAssignmentEntry > PhosphorEngine::GeometryUtils::deserializeZoneAssignments ( const QString & json,
QString * errorString = nullptr )

Parse the wire format serializeZoneAssignments produces back into entries — the two functions are the single serializer/deserializer pair for the batch resnap payload, sharing the same JsonKeys constants so the sides cannot drift.

Entries missing a windowId or targetZoneId are dropped, and so is one whose TargetZoneIds span holds an empty member or does not start with its targetZoneId; a missing VirtualDesktop key (or a negative wire value) yields 0, the current-desktop default. On malformed JSON returns an empty vector and, when errorString is non-null, stores a human-readable parse diagnostic there (empty on success — an empty RESULT with an empty errorString is a legitimate empty batch).

◆ enforceMinSizes()

PHOSPHORGEOMETRY_EXPORT void PhosphorGeometry::enforceMinSizes ( QVector< QRect > & zones,
const QVector< QSize > & minSizes,
int gapThreshold,
int innerGap = 0 )

◆ rectToJson()

PHOSPHORGEOMETRY_EXPORT QString PhosphorGeometry::rectToJson ( const QRect & rect)

◆ removeRectOverlaps()

PHOSPHORGEOMETRY_EXPORT void PhosphorGeometry::removeRectOverlaps ( QVector< QRect > & zones,
const QVector< QSize > & minSizes = {},
int innerGap = 0 )

◆ serializeZoneAssignments()

PHOSPHORENGINE_EXPORT QString PhosphorEngine::GeometryUtils::serializeZoneAssignments ( const QVector< ZoneAssignmentEntry > & entries)

◆ snapToRect()

PHOSPHORGEOMETRY_EXPORT QRect PhosphorGeometry::snapToRect ( const QRectF & rf)