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

Compositor-agnostic floating window state cache. More...

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

Public Member Functions

bool isFloating (const QString &windowId) const
 
bool setFloating (const QString &windowId, bool floating)
 Set windowId's floating state.
 
void clear ()
 
int size () const
 Total entries across BOTH keyspaces (instance floats + app-wide floats).
 
bool insert (const QString &windowId)
 Convenience alias for setFloating(windowId, true).
 
bool remove (const QString &windowId)
 Convenience alias for setFloating(windowId, false).
 

Detailed Description

Compositor-agnostic floating window state cache.

Tracks which windows are floating, dual-keyed so both float kinds resolve:

  • Instance-specific floats (a single window the user/rule floated) are keyed by the STABLE instanceId, like ZoneCache. A window's appId can mutate mid-session (Electron / CEF apps rename their window class), changing the composite appId|instanceId but never the instanceId — keying by it keeps a floated window resolvable across that rename.
  • App-wide floats (a bare appId, e.g. a session-restore marker floating every instance of an app) are keyed by appId and match every instance via the fallback in isFloating. Unlike the instanceId keyspace, this one is NOT class-mutation-safe: a bare-appId entry inserted as slack is not resolved by a later Slack. This matches the authoritative daemon's own appId-keyed markers (same exposure); the rename-robustness guarantee covers only the instance keyspace above.

Mirrors the authoritative WindowTrackingService::setFloating: unfloating a specific instance ALSO drops the coarse app-wide (bare appId) entry. Still- floating siblings keep their own instance entries, so this never clears them; it only removes the session-restore appId marker (matching the daemon, which removes the appId entry unconditionally on instance unfloat — no sibling scan, which would not survive a mid-session class rename anyway).

Member Function Documentation

◆ clear()

void PhosphorCompositor::FloatingCache::clear ( )
inline

◆ insert()

bool PhosphorCompositor::FloatingCache::insert ( const QString &  windowId)
inline

Convenience alias for setFloating(windowId, true).

Kept symmetric with remove() so both entry points share the same guard logic. Returns true iff a tracked entry was actually added.

◆ isFloating()

bool PhosphorCompositor::FloatingCache::isFloating ( const QString &  windowId) const
inline

◆ remove()

bool PhosphorCompositor::FloatingCache::remove ( const QString &  windowId)
inline

Convenience alias for setFloating(windowId, false).

Returns true iff a tracked entry was actually removed.

◆ setFloating()

bool PhosphorCompositor::FloatingCache::setFloating ( const QString &  windowId,
bool  floating 
)
inline

Set windowId's floating state.

Returns true iff a tracked entry was actually added or removed, so a caller can drive a side effect (e.g. re-resolving IsFloating rules) only when the tracked set changed.

◆ size()

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

Total entries across BOTH keyspaces (instance floats + app-wide floats).

Not a window count: an app floated both app-wide and per-instance counts in each. Diagnostics that want "how many windows did the daemon report floating" should log the source list size, not this.


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