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
34enum class DragBypassReason : int {
35 None = 0,
43 ContextDisabled = 3,
45};
46
51inline constexpr int DragBypassReasonCount = 5;
52
54PHOSPHORPROTOCOLTYPES_EXPORT QString toWireString(DragBypassReason r);
55
57PHOSPHORPROTOCOLTYPES_EXPORT DragBypassReason bypassReasonFromWireString(const QString& s);
58
61PHOSPHORPROTOCOLTYPES_EXPORT QDebug operator<<(QDebug debug, DragBypassReason r);
62
75struct PHOSPHORPROTOCOLTYPES_EXPORT DragPolicy
76{
77 bool streamDragMoved = false;
78 bool showOverlay = false;
79 bool grabKeyboard = false;
80 bool captureGeometry = false;
81 bool immediateFloatOnStart = false;
82 QString screenId;
83 DragBypassReason bypassReason = DragBypassReason::None;
84
88 QString validationError() const;
89
95 bool operator==(const DragPolicy&) const = default;
96};
97
102struct PHOSPHORPROTOCOLTYPES_EXPORT DragOutcome
103{
104 enum Action : int {
105 NoOp = 0,
106 ApplyFloat = 1,
107 ApplySnap = 2,
108 RestoreSize = 3,
109 CancelSnap = 4,
110 NotifyDragOutUnsnap = 5
111 };
112
118 Action action = NoOp;
119 QString windowId;
121 int x = 0;
122 int y = 0;
123 int width = 0;
124 int height = 0;
125 QString zoneId;
126 bool skipAnimation = false;
127 bool requestSnapAssist = false;
129
130 QRect toRect() const
131 {
132 return QRect(x, y, width, height);
133 }
134
140 QString validationError() const;
141};
142
143} // namespace PhosphorProtocol
144
145Q_DECLARE_METATYPE(PhosphorProtocol::DragPolicy)
146Q_DECLARE_METATYPE(PhosphorProtocol::DragOutcome)
D-Bus marshalling for the shared tiling-family value types (see AutotileTypes.h; the file names preda...
Definition AutotileMarshalling.h:19
constexpr int DragBypassReasonCount
Number of DragBypassReason values.
Definition DragTypes.h:51
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:34
@ SnappingDisabled
snap mode off globally — dead drag
@ LayoutSuppressed
screen has no zone layout (default assignment suppressed) — dead drag
@ EngineOwnedScreen
drag started/ended on a screen owned by a tiling-family engine (autotile or scrolling),...
@ None
canonical snap path — drag flows through the snap pipeline
@ ContextDisabled
monitor/desktop/activity excluded in settings — dead drag
Drag outcome — daemon-authoritative decision about what to apply at drag end.
Definition DragTypes.h:103
QString windowId
Definition DragTypes.h:119
EmptyZoneList emptyZones
candidate zones for snap assist (empty unless requestSnapAssist)
Definition DragTypes.h:128
QString targetScreenId
Definition DragTypes.h:120
Action
Definition DragTypes.h:104
QString zoneId
populated for ApplySnap
Definition DragTypes.h:125
QString validationError() const
Returns empty QString if valid, or a human-readable description of the invariant violation.
QRect toRect() const
Definition DragTypes.h:130
Drag policy — daemon-authoritative decision about how a drag should be handled.
Definition DragTypes.h:76
bool operator==(const DragPolicy &) const =default
Full structural equality.
QString screenId
screen the drag started/currently is on (virtual-screen-aware)
Definition DragTypes.h:82
QString validationError() const
Returns empty QString if valid, or a human-readable description of the invariant violation.