Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorCompositor::ZoneCache Class Reference

Compositor-agnostic snap-zone state cache. More...

#include <phosphor-compositor/include/PhosphorCompositor/ZoneCache.h>

Public Member Functions

QString zoneForWindow (const QString &windowId) const
 The snap-zone UUID windowId occupies, or empty if it occupies none.
 
bool isSnapped (const QString &windowId) const
 True iff windowId is snapped into a zone (has a non-empty entry).
 
void setZone (const QString &windowId, const QString &zoneId)
 Record windowId's zone.
 
void remove (const QString &windowId)
 
void clear ()
 
int size () const
 

Detailed Description

Compositor-agnostic snap-zone state cache.

Maps a window to the snap-zone UUID it occupies. A window is "snapped" iff it has a non-empty zone entry; a floating or unmanaged window carries no entry. Sibling of FloatingCache — together the two describe a window's placement for the IsSnapped / Zone / IsFloating window-rule match fields. Both caches key per-instance state by the stable instanceId (below); FloatingCache additionally carries an app-wide appId keyspace (a bare appId, e.g. a session-restore marker floating every instance of an app).

Keyed by the STABLE instanceId, not the full composite windowId. A window's appId can mutate mid-session (Electron / CEF apps rename their window class), which changes the composite appId|instanceId but never the instanceId. Keying by instanceId keeps a snapped window's zone resolvable across that rename, so a Zone / IsSnapped rule keeps matching it. All accessors take the composite windowId and extract the instanceId internally, so callers stay composite-id-based. A bare appId (no | separator) is its own instanceId per extractInstanceId, so it degrades gracefully.

Member Function Documentation

◆ clear()

void PhosphorCompositor::ZoneCache::clear ( )
inline

◆ isSnapped()

bool PhosphorCompositor::ZoneCache::isSnapped ( const QString &  windowId) const
inline

True iff windowId is snapped into a zone (has a non-empty entry).

◆ remove()

void PhosphorCompositor::ZoneCache::remove ( const QString &  windowId)
inline

◆ setZone()

void PhosphorCompositor::ZoneCache::setZone ( const QString &  windowId,
const QString &  zoneId 
)
inline

Record windowId's zone.

An empty zoneId removes the entry (the window left its zone — unsnapped / floated / screen-changed).

◆ size()

int PhosphorCompositor::ZoneCache::size ( ) const
inline

◆ zoneForWindow()

QString PhosphorCompositor::ZoneCache::zoneForWindow ( const QString &  windowId) const
inline

The snap-zone UUID windowId occupies, or empty if it occupies none.


The documentation for this class was generated from the following file: