The two cooperating maps a per-monitor placement engine keeps: a forward map from PlacementStateKey to the owning per-screen state object (Qt-parent-owned by the engine, constructed via a caller-supplied factory), and a reverse map from windowId to its owning key.
More...
|
| StateT * | forKey (const PlacementStateKey &key, const std::function< StateT *()> &factory) |
| | Lazily creates the state for key if absent.
|
| |
| StateT * | stateForKey (const PlacementStateKey &key) const |
| | The state for key, or nullptr if none exists (never creates).
|
| |
| bool | containsKey (const PlacementStateKey &key) const |
| |
| void | insertState (const PlacementStateKey &key, StateT *state) |
| | Insert/replace the state at key (caller retains ownership semantics).
|
| |
| StateT * | takeState (const PlacementStateKey &key) |
| | Remove and return the state at key (nullptr if absent). Does not delete.
|
| |
| int | stateCount () const |
| |
| const QHash< PlacementStateKey, StateT * > & | states () const |
| | Read-only view of the forward map for iteration.
|
| |
| bool | hasWindow (const QString &windowId) const |
| |
| PlacementStateKey | keyForWindow (const QString &windowId) const |
| | The owning key for windowId, or a default-constructed key when untracked (mirrors QHash::value — an empty screenId marks "not tracked").
|
| |
| std::optional< PlacementStateKey > | windowKey (const QString &windowId) const |
| | The owning key for windowId, or nullopt when untracked.
|
| |
| void | setKeyForWindow (const QString &windowId, const PlacementStateKey &key) |
| |
| void | removeWindow (const QString &windowId) |
| | Drop the reverse-map entry for windowId (does not touch state objects).
|
| |
| PlacementStateKey | takeWindow (const QString &windowId) |
| | Remove and return the reverse-map entry for windowId (default key when absent), mirroring QHash::take.
|
| |
| const QHash< QString, PlacementStateKey > & | windowKeys () const |
| | Read-only view of the reverse map for iteration.
|
| |
| StateT * | forWindow (const QString &windowId, PlacementStateKey *outKey=nullptr) const |
| | Resolve the state that owns windowId (no create).
|
| |
| void | migrate (const QString &windowId, const PlacementStateKey &oldKey, const PlacementStateKey &newKey) |
| | Move a window's reverse-map entry from oldKey to newKey.
|
| |
| void | rekeyWindows (const PlacementStateKey &oldKey, const PlacementStateKey &newKey) |
| | Rewrite every reverse-map entry pointing at oldKey to newKey.
|
| |
| void | removeStatesIf (const std::function< bool(const PlacementStateKey &, StateT *)> &pred, const std::function< void(const PlacementStateKey &, StateT *)> &onRemove) |
| | Lockstep prune of the forward map: for every state matching pred, invoke onRemove (engine-specific teardown) BEFORE dropping the entry.
|
| |
| void | removeWindowsIf (const std::function< bool(const QString &, const PlacementStateKey &)> &pred) |
| | Drop reverse-map entries matching pred (e.g. a vanished desktop/activity).
|
| |
template<typename StateT>
class PhosphorEngine::PerScreenStates< StateT >
The two cooperating maps a per-monitor placement engine keeps: a forward map from PlacementStateKey to the owning per-screen state object (Qt-parent-owned by the engine, constructed via a caller-supplied factory), and a reverse map from windowId to its owning key.
Both the snap engine (SnapState) and the autotile engine (TilingState) manage exactly this pair; this template holds it once so the lockstep bookkeeping (lazy create, reverse-map maintenance, migration, prune) is written once.
StateT must implement PhosphorEngine::IPlacementState.
Engine-specific lifecycle (algorithm hooks, retile scheduling, overflow bookkeeping, state teardown) is deliberately OUT of this container: the mutation and prune helpers take the engine's callbacks so the engine wraps its own hooks around the pure map moves.