Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorPlacement::SnapStateResolver Struct Reference

Seam onto the snap engine's per-(screen,desktop,activity) SnapState stores. More...

#include <PhosphorPlacement/SnapStateResolver.h>

Public Attributes

std::function< PhosphorSnapEngine::SnapState *(const QString &windowId)> forWindow
 Owning state for a window (reverse-map lookup).
std::function< PhosphorSnapEngine::SnapState *(const QString &windowId, const QString &screenId, int desktop)> forWindowOnScreen
 Owning state for a window placed/acting on a screen: resolves the state (creating it on first placement) AND records the reverse-map entry.
std::function< PhosphorSnapEngine::SnapState *(const QString &screenId)> forScreen
 Owning state for a SCREEN's current (screen, desktop, activity) context, independent of any window — resolves (creating on first use) the per-key store a screen-scoped write (last-used-zone) targets.
std::function< PhosphorSnapEngine::SnapState *()> globals
 The global-scalar holder.
std::function< QList< PhosphorSnapEngine::SnapState * >()> allStates
 Every store, including the global holder, for aggregate iteration.
std::function< void(const QString &windowId)> forgetWindow
 Drop a window's memberships and its data in every member store (window closed / fully removed).
std::function< bool(const QString &windowId, const PhosphorSnapEngine::SnapState *state)> holdsWindow
 Whether state holds a MEMBERSHIP for the window, as opposed to a leftover.
std::function< std::optional< PhosphorEngine::PlacementStateKey >(const PhosphorSnapEngine::SnapState *state)> keyFor
 The (screen, desktop, activity) key state is filed under; nullopt for the global holder, an unknown store or an unwired resolver.
std::function< void(const QString &physicalScreenId)> rekeyToRecordedScreens
 Re-file every membership on a monitor under the key for the screen its store records (SnapEngine::rekeyMembershipsToRecordedScreens).
std::function< void(const QString &oldPhysicalId, const QString &newPhysicalId)> renameScreen
 Re-file every membership filed on the monitor oldPhysicalId (its virtual screens included) under newPhysicalId, after the screen manager flipped an EDID twin's identifier (WindowTrackingService::renameScreen, F189).

Detailed Description

Seam onto the snap engine's per-(screen,desktop,activity) SnapState stores.

The service no longer holds a single SnapState; instead the daemon injects resolvers so each windowId-keyed call reaches the state that owns the window (via the engine's reverse map) and each screen-carrying write reaches — and registers — the state for that screen. globals is the single holder of the still-global last-used-zone / user-snapped scalars, and allStates enumerates every store (including the global holder) for whole-store views. When unset (unit tests / early init) every resolver is empty and the facade degrades to the historical "no SnapState wired" no-op behaviour.

Member Data Documentation

◆ allStates

std::function<QList<PhosphorSnapEngine::SnapState*>()> PhosphorPlacement::SnapStateResolver::allStates

Every store, including the global holder, for aggregate iteration.

CONTRACT: the returned list never contains a null element. An unset resolver yields an empty list rather than a list of nulls, and both wirings filter (SnapEngine::allSnapStates() skips nulls; the single-store convenience wiring rejects a null state outright). Every caller dereferences the elements unguarded, so a resolver that breaks this crashes them all.

◆ forgetWindow

std::function<void(const QString& windowId)> PhosphorPlacement::SnapStateResolver::forgetWindow

Drop a window's memberships and its data in every member store (window closed / fully removed).

◆ forScreen

std::function<PhosphorSnapEngine::SnapState*(const QString& screenId)> PhosphorPlacement::SnapStateResolver::forScreen

Owning state for a SCREEN's current (screen, desktop, activity) context, independent of any window — resolves (creating on first use) the per-key store a screen-scoped write (last-used-zone) targets.

An empty screenId resolves to the global holder.

◆ forWindow

std::function<PhosphorSnapEngine::SnapState*(const QString& windowId)> PhosphorPlacement::SnapStateResolver::forWindow

Owning state for a window (reverse-map lookup).

Non-null by construction in every wiring, by one of two mechanisms: the forwarding resolvers because SnapEngine::stateForWindow falls back to the global holder rather than returning null, and setSnapState's convenience resolver because it rejects a null state outright and captures a non-null one. Two genuine null cases remain, and callers must still guard: an UNSET resolver (see snapForWindow), and the production resolver's QPointer arm once the engine is destroyed while this service still holds the resolver (a real teardown order).

◆ forWindowOnScreen

std::function<PhosphorSnapEngine::SnapState*(const QString& windowId, const QString& screenId, int desktop)> PhosphorPlacement::SnapStateResolver::forWindowOnScreen

Owning state for a window placed/acting on a screen: resolves the state (creating it on first placement) AND records the reverse-map entry.

A pinned desktop (>= 1) names that desktop's store outright, re-homing a window tracked on another screen (SnapEngine::stateForWindowOnScreen); 0 resolves the primary.

◆ globals

std::function<PhosphorSnapEngine::SnapState*()> PhosphorPlacement::SnapStateResolver::globals

The global-scalar holder.

Non-null by construction in every wiring (SnapEngine::globalState() returns the ctor-constructed holder); the same two null cases as forWindow apply — an unset resolver, and the production resolver's QPointer arm after engine destruction.

◆ holdsWindow

std::function<bool(const QString& windowId, const PhosphorSnapEngine::SnapState* state)> PhosphorPlacement::SnapStateResolver::holdsWindow

Whether state holds a MEMBERSHIP for the window, as opposed to a leftover.

A window present on several desktops is a member of one store per desktop; the aggregate walks use this to visit each of those and skip the rest. Unset reads as "only the primary store is a member", the single-membership answer.

◆ keyFor

std::function<std::optional<PhosphorEngine::PlacementStateKey>(const PhosphorSnapEngine::SnapState* state)> PhosphorPlacement::SnapStateResolver::keyFor

The (screen, desktop, activity) key state is filed under; nullopt for the global holder, an unknown store or an unwired resolver.

◆ rekeyToRecordedScreens

std::function<void(const QString& physicalScreenId)> PhosphorPlacement::SnapStateResolver::rekeyToRecordedScreens

Re-file every membership on a monitor under the key for the screen its store records (SnapEngine::rekeyMembershipsToRecordedScreens).

The virtual-screen migrations call it after rewriting the screen values and before their prune. Unset (the single-store convenience) is a no-op: one store has no key to move.

◆ renameScreen

std::function<void(const QString& oldPhysicalId, const QString& newPhysicalId)> PhosphorPlacement::SnapStateResolver::renameScreen

Re-file every membership filed on the monitor oldPhysicalId (its virtual screens included) under newPhysicalId, after the screen manager flipped an EDID twin's identifier (WindowTrackingService::renameScreen, F189).

Unset is a no-op, leaving the stores under the old id. Appended last (abi_policy).


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