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

Zone/layout primitive utilities — pure Layout / Zone operations. More...

Functions

PHOSPHORZONES_EXPORT void serializeAllowLists (QJsonObject &json, const QStringList &screens, const QList< int > &desktops, const QStringList &activities)
 Serialize visibility allow-lists to JSON (only writes non-empty lists)
 
PHOSPHORZONES_EXPORT void deserializeAllowLists (const QJsonObject &json, QStringList &screens, QList< int > &desktops, QStringList &activities)
 Deserialize visibility allow-lists from JSON (clears output params first)
 
PHOSPHORZONES_EXPORT QVariantList zonesToVariantList (Layout *layout, ZoneFields fields=ZoneField::Minimal, const QRectF &referenceGeometry=QRectF())
 Convert all zones in a layout to QVariantList.
 
PHOSPHORZONES_EXPORT QVariantMap layoutToVariantMap (Layout *layout, ZoneFields zoneFields=ZoneField::Minimal)
 Convert a layout to a QVariantMap (metadata + zones)
 
PHOSPHORZONES_EXPORT void sortZonesByNumber (QVector< Zone * > &zones)
 
PHOSPHORZONES_EXPORT QHash< QString, int > buildZonePositionMap (Layout *layout)
 
PHOSPHORZONES_EXPORT QHash< QString, int > buildGlobalZonePositionMap (const QList< Layout * > &layouts)
 Build a global zoneId → position map merged across every layout in layouts.
 

Detailed Description

Zone/layout primitive utilities — pure Layout / Zone operations.

This header carries only code that operates on Layout and Zone types and has no dependency on autotile, settings services, or higher-layer composition (the picker-UI aggregation that stitches manual layouts together with autotile algorithms lives in unifiedlayoutlist.h). Keeping that split lets these primitives eventually live in a standalone phosphor-zones library without dragging autotile or settings services into the dependency graph.

Function Documentation

◆ buildGlobalZonePositionMap()

PHOSPHORZONES_EXPORT QHash< QString, int > PhosphorZones::LayoutUtils::buildGlobalZonePositionMap ( const QList< Layout * > &  layouts)

Build a global zoneId → position map merged across every layout in layouts.

Zone UUIDs are unique across all layouts in the registry, so the merge is unambiguous. Used by the resnap path (lifecycle.cpp + resnap.cpp) when a window's stored zoneId may have come from any layout — for example, after a promote edit shifts the cascade winner from a per-context layout to the screen-level slot.

◆ buildZonePositionMap()

PHOSPHORZONES_EXPORT QHash< QString, int > PhosphorZones::LayoutUtils::buildZonePositionMap ( Layout layout)

◆ deserializeAllowLists()

PHOSPHORZONES_EXPORT void PhosphorZones::LayoutUtils::deserializeAllowLists ( const QJsonObject &  json,
QStringList &  screens,
QList< int > &  desktops,
QStringList &  activities 
)

Deserialize visibility allow-lists from JSON (clears output params first)

◆ layoutToVariantMap()

PHOSPHORZONES_EXPORT QVariantMap PhosphorZones::LayoutUtils::layoutToVariantMap ( Layout layout,
ZoneFields  zoneFields = ZoneField::Minimal 
)

Convert a layout to a QVariantMap (metadata + zones)

Used by LayoutAdaptor for D-Bus and other consumers that want the whole layout as a single map without going through LayoutPreview.

◆ serializeAllowLists()

PHOSPHORZONES_EXPORT void PhosphorZones::LayoutUtils::serializeAllowLists ( QJsonObject &  json,
const QStringList &  screens,
const QList< int > &  desktops,
const QStringList &  activities 
)

Serialize visibility allow-lists to JSON (only writes non-empty lists)

◆ sortZonesByNumber()

PHOSPHORZONES_EXPORT void PhosphorZones::LayoutUtils::sortZonesByNumber ( QVector< Zone * > &  zones)

◆ zonesToVariantList()

PHOSPHORZONES_EXPORT QVariantList PhosphorZones::LayoutUtils::zonesToVariantList ( Layout layout,
ZoneFields  fields = ZoneField::Minimal,
const QRectF &  referenceGeometry = QRectF() 
)

Convert all zones in a layout to QVariantList.

Parameters
layoutThe layout containing zones (returns empty list if null)
fieldsWhich fields to include for each zone
referenceGeometryScreen geometry for normalizing fixed zones (empty = use raw relativeGeometry)
Returns
QVariantList of zone maps