diff --git a/src/interfaces/window.cpp b/src/interfaces/window.cpp index 7fd962f..3e8fa05 100644 --- a/src/interfaces/window.cpp +++ b/src/interfaces/window.cpp @@ -34,6 +34,7 @@ public: QMargins margins; Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow; bool closeOnDismissed = true; + bool accomodateExclusiveZones = true; }; static QMap s_map; @@ -84,6 +85,21 @@ Window::Anchor Window::exclusiveEdge() const return d->exclusiveEdge; } +bool Window::accomodateExclusiveZones() const +{ + return d->accomodateExclusiveZones; +} + +void Window::setAccomodateExclusiveZones(bool accomodate) +{ + if (d->accomodateExclusiveZones == accomodate) { + return; + } + + d->accomodateExclusiveZones = accomodate; + Q_EMIT accomodateExclusiveZonesChanged(); +} + void Window::setMargins(const QMargins &margins) { if (d->margins != margins) { diff --git a/src/interfaces/window.h b/src/interfaces/window.h index 389a6df..da24f0a 100644 --- a/src/interfaces/window.h +++ b/src/interfaces/window.h @@ -25,6 +25,7 @@ class LAYERSHELLQT_EXPORT Window : public QObject Q_PROPERTY(QString scope READ scope WRITE setScope) Q_PROPERTY(QMargins margins READ margins WRITE setMargins NOTIFY marginsChanged) Q_PROPERTY(qint32 exclusionZone READ exclusionZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged) + Q_PROPERTY(bool accomodateExclusiveZones READ accomodateExclusiveZones WRITE setAccomodateExclusiveZones NOTIFY accomodateExclusiveZonesChanged) Q_PROPERTY(Layer layer READ layer WRITE setLayer NOTIFY layerChanged) Q_PROPERTY(KeyboardInteractivity keyboardInteractivity READ keyboardInteractivity WRITE setKeyboardInteractivity NOTIFY keyboardInteractivityChanged) Q_PROPERTY(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration) @@ -83,6 +84,9 @@ public: void setExclusiveEdge(Window::Anchor edge); Window::Anchor exclusiveEdge() const; + bool accomodateExclusiveZones() const; + void setAccomodateExclusiveZones(bool accomodate); + void setMargins(const QMargins &margins); QMargins margins() const; @@ -126,6 +130,7 @@ Q_SIGNALS: void anchorsChanged(); void exclusionZoneChanged(); void exclusiveEdgeChanged(); + void accomodateExclusiveZonesChanged(); void marginsChanged(); void keyboardInteractivityChanged(); void layerChanged(); diff --git a/src/qwaylandlayershellintegration.cpp b/src/qwaylandlayershellintegration.cpp index 2ae367e..b772cc9 100644 --- a/src/qwaylandlayershellintegration.cpp +++ b/src/qwaylandlayershellintegration.cpp @@ -15,7 +15,7 @@ namespace LayerShellQt { QWaylandLayerShellIntegration::QWaylandLayerShellIntegration() - : QWaylandShellIntegrationTemplate(5) + : QWaylandShellIntegrationTemplate(6) , m_xdgActivation(new QWaylandXdgActivationV1) { } diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index 16bc12e..8fdec27 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -56,6 +56,11 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, setExclusiveEdge(m_interface->exclusiveEdge()); }); + setAccomodateExclusiveZones(m_interface->accomodateExclusiveZones()); + connect(m_interface, &Window::accomodateExclusiveZonesChanged, this, [this]() { + setAccomodateExclusiveZones(m_interface->accomodateExclusiveZones()); + }); + setMargins(m_interface->margins()); connect(m_interface, &Window::marginsChanged, this, [this]() { setMargins(m_interface->margins()); @@ -147,6 +152,13 @@ void QWaylandLayerSurface::setExclusiveEdge(uint32_t edge) } } +void QWaylandLayerSurface::setAccomodateExclusiveZones(bool accomodate) +{ + if (zwlr_layer_surface_v1_get_version(object()) >= ZWLR_LAYER_SURFACE_V1_SET_ACCOMODATE_EXCLUSIVE_ZONES_SINCE_VERSION) { + set_accomodate_exclusive_zones(accomodate); + } +} + void QWaylandLayerSurface::setMargins(const QMargins &margins) { set_margin(margins.top(), margins.right(), margins.bottom(), margins.left()); diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index a829acd..ed70763 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -38,6 +38,7 @@ public: void setAnchor(uint32_t anchor); void setExclusiveZone(int32_t zone); void setExclusiveEdge(uint32_t edge); + void setAccomodateExclusiveZones(bool accomodate); void setMargins(const QMargins &margins); void setKeyboardInteractivity(uint32_t interactivity); void setLayer(uint32_t layer); diff --git a/src/wlr-layer-shell-unstable-v1.xml b/src/wlr-layer-shell-unstable-v1.xml index ba4bb61..9aa069b 100644 --- a/src/wlr-layer-shell-unstable-v1.xml +++ b/src/wlr-layer-shell-unstable-v1.xml @@ -25,7 +25,7 @@ THIS SOFTWARE. - + Clients can use this interface to assign the surface_layer role to wl_surfaces. Such surfaces are assigned to a "layer" of the output and @@ -100,7 +100,7 @@ - + An interface that may be implemented by a wl_surface, for surfaces that are designed to be rendered as a layer of a stacked desktop-like @@ -403,5 +403,16 @@ + + + + + + Asks for this surface to not be automatically moved and resized according + to exclusive zones claimed by other surfaces. + + + +