Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
WindowTypes.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorProtocol/phosphorprotocoltypes_export.h>
7
8#include <QList>
9#include <QMetaType>
10#include <QRect>
11#include <QString>
12#include <QStringList>
13
14namespace PhosphorProtocol {
15
29{
30 QString windowId;
31 int x = 0;
32 int y = 0;
33 int width = 0;
34 int height = 0;
35 QString screenId;
36
37 QRect toRect() const
38 {
39 return QRect(x, y, width, height);
40 }
41 static WindowGeometryEntry fromRect(const QString& id, const QRect& r)
42 {
43 return {id, r.x(), r.y(), r.width(), r.height(), QString()};
44 }
45 static WindowGeometryEntry fromRect(const QString& id, const QRect& r, const QString& screenId)
46 {
47 return {id, r.x(), r.y(), r.width(), r.height(), screenId};
48 }
49};
50
51using WindowGeometryList = QList<WindowGeometryEntry>;
52
55{
56 QString windowId;
57 QString zoneId;
58 QString screenId;
59 bool isRestore = false;
60};
61
62using SnapConfirmationList = QList<SnapConfirmationEntry>;
63
66{
67 QString windowId;
68 QString screenId;
69 int minWidth = 0;
70 int minHeight = 0;
71};
72
73using WindowOpenedList = QList<WindowOpenedEntry>;
74
77{
78 QString windowId;
79 QString zoneId;
80 QString screenId;
81 bool isFloating = false;
82 QString changeType;
83 QStringList zoneIds;
84 bool isSticky = false;
85
91 QString validationError() const
92 {
93 if (windowId.isEmpty()) {
94 return QStringLiteral("WindowStateEntry: empty windowId");
95 }
96 return QString();
97 }
98};
99
100using WindowStateList = QList<WindowStateEntry>;
101
107{
108 bool found = false;
109 QStringList zoneIds;
110 QString screenName;
111 int x = 0;
112 int y = 0;
113 int width = 0;
114 int height = 0;
115
116 QRect toRect() const
117 {
118 return QRect(x, y, width, height);
119 }
120};
121
122} // namespace PhosphorProtocol
123
125Q_DECLARE_METATYPE(PhosphorProtocol::WindowGeometryList)
128Q_DECLARE_METATYPE(PhosphorProtocol::WindowOpenedEntry)
129Q_DECLARE_METATYPE(PhosphorProtocol::WindowOpenedList)
130Q_DECLARE_METATYPE(PhosphorProtocol::WindowStateEntry)
131Q_DECLARE_METATYPE(PhosphorProtocol::WindowStateList)
D-Bus marshalling for the autotile value types (see AutotileTypes.h).
Definition AutotileMarshalling.h:16
QList< WindowGeometryEntry > WindowGeometryList
Definition WindowTypes.h:51
QList< SnapConfirmationEntry > SnapConfirmationList
Definition WindowTypes.h:62
QList< WindowOpenedEntry > WindowOpenedList
Definition WindowTypes.h:73
QList< WindowStateEntry > WindowStateList
Definition WindowTypes.h:100
D-Bus struct for batch snap confirmation: (sssb)
Definition WindowTypes.h:55
QString windowId
Definition WindowTypes.h:56
bool isRestore
Definition WindowTypes.h:59
QString zoneId
Definition WindowTypes.h:57
QString screenId
Definition WindowTypes.h:58
D-Bus struct for unfloat restore result: (bassiiii).
Definition WindowTypes.h:107
QStringList zoneIds
D-Bus type 'as'.
Definition WindowTypes.h:109
int y
Definition WindowTypes.h:112
int x
Definition WindowTypes.h:111
QString screenName
Definition WindowTypes.h:110
int height
Definition WindowTypes.h:114
bool found
Definition WindowTypes.h:108
int width
Definition WindowTypes.h:113
QRect toRect() const
Definition WindowTypes.h:116
D-Bus struct for batch geometry entries: (siiiis)
Definition WindowTypes.h:29
int width
Definition WindowTypes.h:33
QString screenId
target VS/physical screen (empty = fall back to geometry resolution)
Definition WindowTypes.h:35
QString windowId
Definition WindowTypes.h:30
static WindowGeometryEntry fromRect(const QString &id, const QRect &r, const QString &screenId)
Definition WindowTypes.h:45
static WindowGeometryEntry fromRect(const QString &id, const QRect &r)
Definition WindowTypes.h:41
QRect toRect() const
Definition WindowTypes.h:37
int x
Definition WindowTypes.h:31
int y
Definition WindowTypes.h:32
int height
Definition WindowTypes.h:34
D-Bus struct for batch window-opened notification: (ssii)
Definition WindowTypes.h:66
QString windowId
Definition WindowTypes.h:67
QString screenId
Definition WindowTypes.h:68
int minWidth
Definition WindowTypes.h:69
int minHeight
Definition WindowTypes.h:70
D-Bus struct for window state: (sssbsasb)
Definition WindowTypes.h:77
QString changeType
"snapped", "unsnapped", "floated", "unfloated", "screen_changed"
Definition WindowTypes.h:82
QString screenId
Definition WindowTypes.h:80
QString validationError() const
Returns empty QString if valid, else a human-readable description of the invariant violation.
Definition WindowTypes.h:91
QString windowId
Definition WindowTypes.h:78
QString zoneId
Definition WindowTypes.h:79
bool isFloating
Definition WindowTypes.h:81
QStringList zoneIds
D-Bus type 'as' — all zone IDs for multi-zone span (query only)
Definition WindowTypes.h:83
bool isSticky
Whether window is on all virtual desktops (query only)
Definition WindowTypes.h:84