Exported because this is a header-only template used from every engine library, so the category has to resolve outside phosphor-engine.
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.
|
| void | setContextKeyResolver (ContextKeyResolver resolver) |
| bool | hasWindow (const QString &windowId) const |
| PlacementStateKey | keyForWindow (const QString &windowId) const |
| | The PRIMARY key for windowId, or a default-constructed key when untracked (an empty screenId marks "not tracked", as before).
|
| std::optional< PlacementStateKey > | windowKey (const QString &windowId) const |
| | The PRIMARY key for windowId, or nullopt when untracked.
|
| QList< PlacementStateKey > | membershipsForWindow (const QString &windowId) const |
| | Every state this window belongs to, in the order they were added.
|
| bool | hasMembership (const QString &windowId, const PlacementStateKey &key) const |
| | Whether windowId belongs to the state at key specifically.
|
| void | setKeyForWindow (const QString &windowId, const PlacementStateKey &key) |
| | Make key the window's ONLY membership.
|
| void | addMembership (const QString &windowId, const PlacementStateKey &key) |
| | Add key to the window's memberships, keeping the ones it has.
|
| void | removeMembership (const QString &windowId, const PlacementStateKey &key) |
| | Drop one membership.
|
| void | removeWindow (const QString &windowId) |
| | Drop EVERY membership for windowId (does not touch state objects).
|
| PlacementStateKey | takeWindow (const QString &windowId) |
| | Remove every membership and return the primary (default key when absent), mirroring QHash::take.
|
| QStringList | trackedWindowIds () const |
| | Every tracked window id, once each however many states hold it.
|
| void | forEachMembership (const std::function< void(const QString &, const PlacementStateKey &)> &fn) const |
| | Visit every (windowId, key) membership pair.
|
| StateT * | forWindow (const QString &windowId, PlacementStateKey *outKey=nullptr) const |
| | Resolve the state holding windowId's PRIMARY membership (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 membership equal to 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 MEMBERSHIPS matching pred (e.g.
|
template<typename StateT>
class PhosphorEngine::PerScreenStates< StateT >
Exported because this is a header-only template used from every engine library, so the category has to resolve outside phosphor-engine.
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 the keys of every state holding it (its memberships, with a context resolver picking the primary). The snap, autotile and scroll engines manage exactly this pair; this template holds it once so the lockstep bookkeeping (lazy create, membership 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.