6#include "phosphorwayland_export.h"
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";
38class PHOSPHORWAYLAND_EXPORT LayerSurface :
public QObject
41 Q_DISABLE_COPY_MOVE(LayerSurface)
69 Q_ENUM(KeyboardInteractivity)
78 Q_DECLARE_FLAGS(Anchors, Anchor)
120 static LayerSurface*
get(QWindow* window);
123 static LayerSurface*
find(QWindow* window);
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;
179 explicit LayerSurface(QWindow* window);
181 void emitPropertiesChanged();
183 QPointer<QWindow> m_window;
184 int m_batchDepth = 0;
185 bool m_batchDirty =
false;
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
static LayerSurface * find(QWindow *window)
Retrieve existing LayerSurface for the window, or nullptr.
Anchors exclusiveEdge() const
void exclusiveZoneChanged()
static LayerSurface * get(QWindow *window)
Get or create a LayerSurface for the given window (call before first show()).
static std::pair< uint32_t, uint32_t > computeLayerSize(Anchors anchors, const QSize &windowSize)
Compute layer-shell size: 0 for axes anchored to both edges.
Anchor
Definition LayerSurface.h:71
@ AnchorTop
Definition LayerSurface.h:73
@ AnchorBottom
Definition LayerSurface.h:74
@ AnchorLeft
Definition LayerSurface.h:75
@ AnchorNone
Definition LayerSurface.h:72
@ AnchorRight
Definition LayerSurface.h:76
Layer
Definition LayerSurface.h:56
@ LayerBackground
Definition LayerSurface.h:57
@ LayerTop
Definition LayerSurface.h:59
@ LayerBottom
Definition LayerSurface.h:58
@ LayerOverlay
Definition LayerSurface.h:60
KeyboardInteractivity
Definition LayerSurface.h:64
@ KeyboardInteractivityOnDemand
Definition LayerSurface.h:67
@ KeyboardInteractivityExclusive
Definition LayerSurface.h:66
@ KeyboardInteractivityNone
Definition LayerSurface.h:65
void setLayer(Layer layer)
void setMargins(const QMargins &margins)
void setExclusiveZone(int32_t zone)
void keyboardInteractivityChanged()
void setDesiredSize(const QSize &size)
Override the layer-shell set_size value sent on the next configure- triggering commit,...
void setScreen(QScreen *screen)
QSize desiredSize() const
KeyboardInteractivity keyboardInteractivity() const
void setExclusiveEdge(Anchors edge)
void setKeyboardInteractivity(KeyboardInteractivity interactivity)
void exclusiveEdgeChanged()
void desiredSizeChanged()
static bool isSupported()
True if the compositor supports zwlr_layer_shell_v1.
static constexpr Anchors AnchorAll
Definition LayerSurface.h:81
int32_t exclusiveZone() const
void setAnchors(Anchors anchors)
void setScope(const QString &scope)
Property keys used by LayerSurface ↔ QPA plugin communication.
Definition LayerSurface.h:19
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 BackgroundEffect.h:15