7#include <phosphorengine_export.h>
63 std::optional<WindowPlacement>
take(
const QString& windowId,
const QString& appId,
119 std::optional<WindowPlacement>
takeForReopen(
const QString& engineId,
const QString& windowId,
const QString& appId,
120 const QString& screenId);
126 std::optional<WindowPlacement>
peek(
const QString& windowId,
const QString& appId,
133 std::optional<WindowPlacement>
peekExact(
const QString& windowId)
const
135 return peek(windowId, QString());
160 std::optional<WindowPlacement>
peekForReclaim(
const QString& windowId,
const QString& appId,
165 bool contains(
const QString& windowId,
const QString& appId = QString())
const;
173 m_liveInstanceProbe = std::move(probe);
204 bool clear(
const QString& windowId);
272 void evictForCapacity(QList<WindowPlacement>& bucket);
276 static constexpr int MaxPerApp = 16;
284 QHash<QString, QList<WindowPlacement>> m_byApp;
285 quint64 m_sequence = 0;
286 std::function<bool(
const QString&)> m_liveInstanceProbe;
The single source of truth for window restore state in the unified model.
Definition WindowPlacementStore.h:34
bool clear(const QString &windowId)
Drop any record for the same live instance (and prune the empty bucket).
bool collapsePureFloatSiblings(const QString &appId, const QString &keepWindowId)
Collapse stale pure-float duplicates for an app, keeping keepWindowId.
bool releaseEngineSlot(const QString &windowId, const QString &engineId)
DOWNGRADE one engine's slot to WindowPlacement::stateReleased() on every record for the same live ins...
std::optional< WindowPlacement > peekForReclaim(const QString &windowId, const QString &appId, const std::function< bool(const WindowPlacement &)> &accept={}) const
Non-consuming lookup for the cross-screen reclaim (IPlacementEngine::claimCrossScreenReopen).
std::optional< WindowPlacement > peekExact(const QString &windowId) const
Same-instance peek: branch 1 of peek() only, never the appId-FIFO fallback.
Definition WindowPlacementStore.h:133
std::optional< WindowPlacement > takeForReopen(const QString &engineId, const QString &windowId, const QString &appId, const QString &screenId)
Reopen resolve: the shared consumption pattern the TILING engines' open-time restores use (SnapEngine...
bool contains(const QString &windowId, const QString &appId=QString()) const
True if a record exists for the same live instance, or (if appId non-empty) any record in that appId ...
void setLiveInstanceProbe(std::function< bool(const QString &windowId)> probe)
Inject the live-window probe takeForReopen's appId fallback uses to skip records bound to a still-ope...
Definition WindowPlacementStore.h:171
int transform(const std::function< bool(WindowPlacement &)> &fn)
Apply an in-place mutation to every record; fn returns true when it changed the record.
int removeIf(const std::function< bool(const WindowPlacement &)> &pred)
Remove every record matching pred. Returns the count removed.
std::optional< WindowPlacement > peek(const QString &windowId, const QString &appId, const std::function< bool(const WindowPlacement &)> &accept={}) const
Non-consuming lookup (unlike take): the record for the same live instance, else the NEWEST record in ...
QList< WindowPlacement > records() const
All records, in no particular order.
std::optional< WindowPlacement > take(const QString &windowId, const QString &appId, const std::function< bool(const WindowPlacement &)> &accept={}, const std::function< bool(const WindowPlacement &)> &preferred={})
Restore lookup: the first record whose accept predicate passes, trying the same-instance match before...
bool clearFreeGeometry(const QString &windowId)
Clear ONLY the shared free/float geometry for the same live instance, leaving the engine slots and co...
QJsonObject serialize(const std::function< bool(const WindowPlacement &)> &keep={}) const
JSON shape: { appId: [ record, ... ] }.
WindowPlacementStore()=default
void deserialize(const QJsonObject &obj)
bool clearFreeGeometry(const QString &windowId, const QString &screenId)
bool record(WindowPlacement placement)
Record / MERGE this window's placement.
Definition EngineTypes.h:14
One window's single, authoritative placement record — the unit of the unified, engine-agnostic restor...
Definition WindowPlacement.h:68