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
 
void setFloating (const QString &windowId, bool floating)
 
void clear ()
 
int size () const
 Total entries across BOTH keyspaces (instance floats + app-wide floats).
 
void insert (const QString &windowId)
 Convenience alias for setFloating(windowId, true).
 
void 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()

void 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.

◆ isFloating()

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

◆ remove()

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

Convenience alias for setFloating(windowId, false).

◆ setFloating()

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

◆ 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 (see NavigationHandler::syncFloatingWindowsFromDaemon).


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