11#include <QLatin1String>
45 return state.isEmpty();
112 if (it.value().isValid()) {
137 for (
auto it =
engines.constBegin(); it !=
engines.constEnd(); ++it) {
169 return QLatin1String(
"snap");
173 return QLatin1String(
"autotile");
185 return QLatin1String(
"free");
189 return QLatin1String(
"floating");
193 return QLatin1String(
"snapped");
197 return QLatin1String(
"tiled");
203 obj[QLatin1String(
"windowId")] =
windowId;
204 obj[QLatin1String(
"screen")] =
screenId;
207 obj[QLatin1String(
"activity")] =
activity;
209 obj[QLatin1String(
"kind")] =
static_cast<int>(
kind);
212 for (
auto it =
engines.constBegin(); it !=
engines.constEnd(); ++it) {
218 so[QLatin1String(
"state")] = s.
state;
221 for (
const QString&
id : s.
zoneIds) {
224 so[QLatin1String(
"zoneIds")] = z;
227 so[QLatin1String(
"order")] = s.
order;
231 if (!eng.isEmpty()) {
232 obj[QLatin1String(
"engines")] = eng;
237 const QRect& g = it.value();
242 go[QLatin1String(
"x")] = g.x();
243 go[QLatin1String(
"y")] = g.y();
244 go[QLatin1String(
"w")] = g.width();
245 go[QLatin1String(
"h")] = g.height();
249 obj[QLatin1String(
"freeGeo")] = fg;
252 obj[QLatin1String(
"seq")] =
static_cast<double>(
sequence);
260 p.
windowId = obj.value(QLatin1String(
"windowId")).toString();
261 p.
screenId = obj.value(QLatin1String(
"screen")).toString();
263 p.
activity = obj.value(QLatin1String(
"activity")).toString();
266 const QJsonObject eng = obj.value(QLatin1String(
"engines")).toObject();
267 for (
auto it = eng.constBegin(); it != eng.constEnd(); ++it) {
268 const QJsonObject so = it.value().toObject();
270 s.
state = so.value(QLatin1String(
"state")).toString();
271 for (
const QJsonValue& v : so.value(QLatin1String(
"zoneIds")).toArray()) {
272 const QString z = v.toString();
277 s.
order = so.value(QLatin1String(
"order")).toInt(-1);
283 const QJsonObject fg = obj.value(QLatin1String(
"freeGeo")).toObject();
284 for (
auto it = fg.constBegin(); it != fg.constEnd(); ++it) {
285 const QJsonObject go = it.value().toObject();
286 const QRect g(go.value(QLatin1String(
"x")).toInt(), go.value(QLatin1String(
"y")).toInt(),
287 go.value(QLatin1String(
"w")).toInt(), go.value(QLatin1String(
"h")).toInt());
293 p.
sequence =
static_cast<quint64
>(obj.value(QLatin1String(
"seq")).toDouble());
Definition EngineTypes.h:13
WindowKind clampWindowKindFromWire(int wire)
Clamp an integer wire value to a valid WindowKind.
Definition EngineTypes.h:52
WindowKind
Coarse structural classification for the snap-restore consume gate.
Definition EngineTypes.h:39
One engine's view of a window: which managed slot it occupies (or that it is floating / unmanaged) in...
Definition WindowPlacement.h:30
bool isEmpty() const
Definition WindowPlacement.h:43
int order
autotile slot — tile index within the screen; -1 for snap
Definition WindowPlacement.h:33
bool operator==(const EngineSlot &o) const
Definition WindowPlacement.h:35
bool operator!=(const EngineSlot &o) const
Definition WindowPlacement.h:39
QStringList zoneIds
snap slot — zone UUIDs (first is primary); empty for autotile
Definition WindowPlacement.h:32
QString state
engine-defined token: snap "snapped"/"floating"; autotile "tiled"/"floating" ("free" retired)
Definition WindowPlacement.h:31
One window's single, authoritative placement record — the unit of the unified, engine-agnostic restor...
Definition WindowPlacement.h:66
EngineSlot slotFor(const QString &engineId) const
The slot for engineId, or a default (empty) slot if this engine has no recorded state for the window.
Definition WindowPlacement.h:93
static QLatin1String snapEngineId()
Built-in engine-slot ids.
Definition WindowPlacement.h:167
static QLatin1String stateFree()
Common state-token vocabulary.
Definition WindowPlacement.h:183
QRect freeGeometryFor(const QString &screenId) const
The shared free/float geometry for screenId, or an invalid rect if none has been captured on that scr...
Definition WindowPlacement.h:100
static QLatin1String autotileEngineId()
Definition WindowPlacement.h:171
WindowKind kind
Definition WindowPlacement.h:75
bool isValid() const
Definition WindowPlacement.h:86
static QLatin1String stateTiled()
Definition WindowPlacement.h:195
bool sameContentAs(const WindowPlacement &o) const
Content equality IGNORING sequence (the store stamps a fresh sequence on every record(),...
Definition WindowPlacement.h:155
int virtualDesktop
0 = all-desktops / sticky / unknown
Definition WindowPlacement.h:73
QString activity
empty = all-activities / unknown
Definition WindowPlacement.h:74
static QLatin1String stateFloating()
Definition WindowPlacement.h:187
QRect anyFreeGeometry() const
Any captured free/float geometry (the first valid rect in unspecified hash order — there is no per-sc...
Definition WindowPlacement.h:109
QJsonObject toJson() const
Definition WindowPlacement.h:200
static QLatin1String stateSnapped()
Definition WindowPlacement.h:191
static WindowPlacement fromJson(const QString &appId, const QJsonObject &obj)
Definition WindowPlacement.h:256
QString screenId
last managed-context screen
Definition WindowPlacement.h:72
quint64 sequence
Definition WindowPlacement.h:84
QHash< QString, EngineSlot > engines
Definition WindowPlacement.h:78
QString appId
window class; FIFO key for close/reopen (uuid changes)
Definition WindowPlacement.h:69
QHash< QString, QRect > freeGeometryByScreen
Definition WindowPlacement.h:81
QString windowId
full appId|uuid; exact key for daemon-restart (uuid stable)
Definition WindowPlacement.h:68
bool hasRestorableContent() const
Whether this record carries anything worth restoring.
Definition WindowPlacement.h:132