6#include <phosphorwayland_export.h>
19namespace LayerSurfaceProps {
21inline constexpr const char*
Surface =
"_ps_layer_shell_surface";
22inline constexpr const char*
Layer =
"_ps_layer";
23inline constexpr const char*
Anchors =
"_ps_anchors";
25inline constexpr const char*
Keyboard =
"_ps_keyboard";
26inline constexpr const char*
Scope =
"_ps_scope";
28inline constexpr const char*
MarginsTop =
"_ps_margins_top";
43 Q_PROPERTY(
Layer layer READ layer WRITE setLayer NOTIFY layerChanged)
44 Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged)
45 Q_PROPERTY(int32_t exclusiveZone READ exclusiveZone WRITE setExclusiveZone NOTIFY exclusiveZoneChanged)
46 Q_PROPERTY(
KeyboardInteractivity keyboardInteractivity READ keyboardInteractivity WRITE setKeyboardInteractivity
47 NOTIFY keyboardInteractivityChanged)
48 Q_PROPERTY(QString scope READ scope WRITE setScope NOTIFY scopeChanged)
49 Q_PROPERTY(QScreen* screen READ screen WRITE setScreen NOTIFY screenChanged)
50 Q_PROPERTY(QMargins margins READ margins WRITE setMargins NOTIFY marginsChanged)
51 Q_PROPERTY(Anchors exclusiveEdge READ exclusiveEdge WRITE setExclusiveEdge NOTIFY exclusiveEdgeChanged)
65 KeyboardInteractivityNone = 0,
66 KeyboardInteractivityExclusive = 1,
67 KeyboardInteractivityOnDemand = 2,
69 Q_ENUM(KeyboardInteractivity)
78 Q_DECLARE_FLAGS(Anchors, Anchor)
81 static constexpr Anchors AnchorAll = Anchors(AnchorTop | AnchorBottom | AnchorLeft | AnchorRight);
87 void setAnchors(Anchors anchors);
88 Anchors anchors() const;
90 void setExclusiveZone(int32_t zone);
91 int32_t exclusiveZone() const;
96 void setMargins(const QMargins& margins);
97 QMargins margins() const;
99 void setExclusiveEdge(Anchors edge);
100 Anchors exclusiveEdge() const;
109 void setDesiredSize(const QSize& size);
110 QSize desiredSize() const;
113 void setScope(const QString& scope);
114 QString scope() const;
116 void setScreen(QScreen* screen);
117 QScreen* screen() const;
126 static
bool isSupported();
129 static std::pair<uint32_t, uint32_t> computeLayerSize(Anchors anchors, const QSize& windowSize);
133 void anchorsChanged();
134 void exclusiveZoneChanged();
135 void keyboardInteractivityChanged();
137 void marginsChanged();
138 void exclusiveEdgeChanged();
139 void screenChanged();
140 void desiredSizeChanged();
141 void propertiesChanged();
152 ++m_surface->m_batchDepth;
158 Q_ASSERT(m_surface->m_batchDepth > 0);
159 if (--m_surface->m_batchDepth == 0 && m_surface->m_batchDirty) {
160 m_surface->m_batchDirty =
false;
161 Q_EMIT m_surface->propertiesChanged();
168 : m_surface(std::exchange(other.m_surface,
nullptr))
174 QPointer<LayerSurface> m_surface;
181 void emitPropertiesChanged();
183 QPointer<QWindow> m_window;
184 int m_batchDepth = 0;
185 bool m_batchDirty =
false;
186 Layer m_layer = LayerTop;
188 int32_t m_exclusiveZone = -1;
191 QPointer<QScreen> m_screen;
193 Anchors m_exclusiveEdge;
195 QMetaObject::Connection m_destroyedConnection;
198Q_DECLARE_OPERATORS_FOR_FLAGS(LayerSurface::Anchors)
RAII guard: suppresses propertiesChanged() until destroyed.
Definition LayerSurface.h:146
BatchGuard & operator=(BatchGuard &&)=delete
BatchGuard(LayerSurface *surface)
Definition LayerSurface.h:148
BatchGuard(BatchGuard &&other) noexcept
Definition LayerSurface.h:167
~BatchGuard()
Definition LayerSurface.h:155
BatchGuard & operator=(const BatchGuard &)=delete
BatchGuard(const BatchGuard &)=delete
Wayland layer-shell surface backed by zwlr_layer_shell_v1.
Definition LayerSurface.h:39
Anchor
Definition LayerSurface.h:71
Layer
Definition LayerSurface.h:56
KeyboardInteractivity
Definition LayerSurface.h:64
constexpr const char * MarginsRight
Definition LayerSurface.h:29
constexpr const char * MarginsLeft
Definition LayerSurface.h:27
constexpr const char * Keyboard
Definition LayerSurface.h:25
constexpr const char * DesiredWidth
Definition LayerSurface.h:32
constexpr const char * IsLayerShell
Definition LayerSurface.h:20
constexpr const char * ExclusiveZone
Definition LayerSurface.h:24
constexpr const char * Anchors
Definition LayerSurface.h:23
constexpr const char * Surface
Definition LayerSurface.h:21
constexpr const char * MarginsTop
Definition LayerSurface.h:28
constexpr const char * DesiredHeight
Definition LayerSurface.h:33
constexpr const char * Scope
Definition LayerSurface.h:26
constexpr const char * MarginsBottom
Definition LayerSurface.h:30
constexpr const char * Layer
Definition LayerSurface.h:22
constexpr const char * ExclusiveEdge
Definition LayerSurface.h:31
Definition CompositorLost.h:11