Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
DragTypes.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
7#include <PhosphorProtocol/phosphorprotocoltypes_export.h>
8
9#include <QMetaType>
10#include <QRect>
11#include <QString>
12
13class QDebug;
14
15namespace PhosphorProtocol {
16
29enum class DragBypassReason : int {
30 None = 0,
31 AutotileScreen = 1,
33 ContextDisabled = 3,
34};
35
37PHOSPHORPROTOCOLTYPES_EXPORT QString toWireString(DragBypassReason r);
38
40PHOSPHORPROTOCOLTYPES_EXPORT DragBypassReason bypassReasonFromWireString(const QString& s);
41
43PHOSPHORPROTOCOLTYPES_EXPORT QDebug operator<<(QDebug debug, DragBypassReason r);
44
57struct PHOSPHORPROTOCOLTYPES_EXPORT DragPolicy
58{
59 bool streamDragMoved = false;
60 bool showOverlay = false;
61 bool grabKeyboard = false;
62 bool captureGeometry = false;
63 bool immediateFloatOnStart = false;
64 QString screenId;
65 DragBypassReason bypassReason = DragBypassReason::None;
66
70 QString validationError() const;
71
77 bool operator==(const DragPolicy&) const = default;
78};
79
84struct PHOSPHORPROTOCOLTYPES_EXPORT DragOutcome
85{
86 enum Action : int {
87 NoOp = 0,
88 ApplyFloat = 1,
89 ApplySnap = 2,
90 RestoreSize = 3,
91 CancelSnap = 4,
92 NotifyDragOutUnsnap = 5
93 };
94
95 int action = NoOp;
96 QString windowId;
98 int x = 0;
99 int y = 0;
100 int width = 0;
101 int height = 0;
102 QString zoneId;
103 bool skipAnimation = false;
104 bool requestSnapAssist = false;
106
107 QRect toRect() const
108 {
109 return QRect(x, y, width, height);
110 }
111
117 QString validationError() const;
118};
119
120} // namespace PhosphorProtocol
121
122Q_DECLARE_METATYPE(PhosphorProtocol::DragPolicy)
123Q_DECLARE_METATYPE(PhosphorProtocol::DragOutcome)
D-Bus marshalling for the autotile value types (see AutotileTypes.h).
Definition AutotileMarshalling.h:16
PHOSPHORPROTOCOLTYPES_EXPORT DragBypassReason bypassReasonFromWireString(const QString &s)
Parse from the legacy wire-format string. Unknown values map to None.
PHOSPHORPROTOCOL_EXPORT QDBusArgument & operator<<(QDBusArgument &arg, const TileRequestEntry &e)
QList< EmptyZoneEntry > EmptyZoneList
Definition ZoneTypes.h:58
PHOSPHORPROTOCOLTYPES_EXPORT QString toWireString(DragBypassReason r)
Convert to the legacy wire-format string. Returns an empty QString for None.
DragBypassReason
Why a drag was bypassed from the canonical snap pipeline.
Definition DragTypes.h:29
@ SnappingDisabled
snap mode off globally — dead drag
@ None
canonical snap path — drag flows through the snap pipeline
@ AutotileScreen
drag started/ended on an autotile screen — engine owns placement
@ ContextDisabled
monitor/desktop/activity excluded in settings — dead drag
Drag outcome — daemon-authoritative decision about what to apply at drag end.
Definition DragTypes.h:85
QString windowId
Definition DragTypes.h:96
EmptyZoneList emptyZones
candidate zones for snap assist (empty unless requestSnapAssist)
Definition DragTypes.h:105
QString targetScreenId
Definition DragTypes.h:97
Action
Definition DragTypes.h:86
QString zoneId
populated for ApplySnap
Definition DragTypes.h:102
QString validationError() const
Returns empty QString if valid, or a human-readable description of the invariant violation.
QRect toRect() const
Definition DragTypes.h:107
Drag policy — daemon-authoritative decision about how a drag should be handled.
Definition DragTypes.h:58
bool operator==(const DragPolicy &) const =default
Full structural equality.
QString screenId
screen the drag started/currently is on (virtual-screen-aware)
Definition DragTypes.h:64
QString validationError() const
Returns empty QString if valid, or a human-readable description of the invariant violation.