diff --git a/src/interfaces/window.cpp b/src/interfaces/window.cpp index 3e8fa05..3feb272 100644 --- a/src/interfaces/window.cpp +++ b/src/interfaces/window.cpp @@ -34,7 +34,7 @@ public: QMargins margins; Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow; bool closeOnDismissed = true; - bool accomodateExclusiveZones = true; + Window::AnchorRect anchorRect = Window::AnchorRectWorkArea; }; static QMap s_map; @@ -85,19 +85,19 @@ Window::Anchor Window::exclusiveEdge() const return d->exclusiveEdge; } -bool Window::accomodateExclusiveZones() const +Window::AnchorRect Window::anchorRect() const { - return d->accomodateExclusiveZones; + return d->anchorRect; } -void Window::setAccomodateExclusiveZones(bool accomodate) +void Window::setAnchorRect(Window::AnchorRect anchorRect) { - if (d->accomodateExclusiveZones == accomodate) { + if (d->anchorRect == anchorRect) { return; } - d->accomodateExclusiveZones = accomodate; - Q_EMIT accomodateExclusiveZonesChanged(); + d->anchorRect = anchorRect; + Q_EMIT anchorRectChanged(); } void Window::setMargins(const QMargins &margins) diff --git a/src/interfaces/window.h b/src/interfaces/window.h index da24f0a..4c9857f 100644 --- a/src/interfaces/window.h +++ b/src/interfaces/window.h @@ -25,7 +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(AnchorRect anchorRect READ anchorRect WRITE setAnchorRect NOTIFY anchorRectChanged) 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) @@ -43,6 +43,12 @@ public: Q_ENUM(Anchor); Q_DECLARE_FLAGS(Anchors, Anchor) + /** + * This enum is used to choose between anchoring to work area or screen area + */ + enum AnchorRect { AnchorRectWorkArea = 0, AnchorRectFullArea = 1 }; + Q_ENUM(AnchorRect); + /** * This enum type is used to specify the layer where a surface can be put in. */ @@ -84,8 +90,8 @@ public: void setExclusiveEdge(Window::Anchor edge); Window::Anchor exclusiveEdge() const; - bool accomodateExclusiveZones() const; - void setAccomodateExclusiveZones(bool accomodate); + AnchorRect anchorRect() const; + void setAnchorRect(AnchorRect anchorRect); void setMargins(const QMargins &margins); QMargins margins() const; @@ -130,7 +136,7 @@ Q_SIGNALS: void anchorsChanged(); void exclusionZoneChanged(); void exclusiveEdgeChanged(); - void accomodateExclusiveZonesChanged(); + void anchorRectChanged(); void marginsChanged(); void keyboardInteractivityChanged(); void layerChanged(); diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index f35f6b8..eca59da 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -56,9 +56,9 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, setExclusiveEdge(m_interface->exclusiveEdge()); }); - setAccomodateExclusiveZones(m_interface->accomodateExclusiveZones()); - connect(m_interface, &Window::accomodateExclusiveZonesChanged, this, [this]() { - setAccomodateExclusiveZones(m_interface->accomodateExclusiveZones()); + setAnchorRect(m_interface->anchorRect()); + connect(m_interface, &Window::anchorRectChanged, this, [this]() { + setAnchorRect(m_interface->anchorRect()); }); setMargins(m_interface->margins()); @@ -156,10 +156,10 @@ void QWaylandLayerSurface::setExclusiveEdge(uint32_t edge) } } -void QWaylandLayerSurface::setAccomodateExclusiveZones(bool accomodate) +void QWaylandLayerSurface::setAnchorRect(int32_t anchorRect) { - if (zwlr_layer_surface_v1_get_version(object()) >= ZWLR_LAYER_SURFACE_V1_SET_ACCOMODATE_EXCLUSIVE_ZONES_SINCE_VERSION) { - set_accomodate_exclusive_zones(accomodate); + if (zwlr_layer_surface_v1_get_version(object()) >= ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_RECT_SINCE_VERSION) { + set_anchor_rect(anchorRect); } } diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index 0d5c81e..904c2e0 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -8,6 +8,7 @@ #ifndef _LAYERSURFACE_H #define _LAYERSURFACE_H +#include #include #include "qwaylandlayershellintegration_p.h" @@ -38,7 +39,7 @@ public: void setAnchor(uint32_t anchor); void setExclusiveZone(int32_t zone); void setExclusiveEdge(uint32_t edge); - void setAccomodateExclusiveZones(bool accomodate); + void setAnchorRect(int32_t anchorRect); 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 19dfd82..9be06f9 100644 --- a/src/wlr-layer-shell-unstable-v1.xml +++ b/src/wlr-layer-shell-unstable-v1.xml @@ -382,6 +382,11 @@ + + + + + @@ -411,18 +416,19 @@ - - - Asks for this surface to not be automatically moved and resized according to - exclusive zones claimed by other surfaces. + + + When this surface is anchored, it can be to two possible anchor rects. - The accomodate parameter is treated as a boolean flag, a zero value means false, - a non zero value means true. + The work area rect (anchor_rect_work_area) is the usable space, excluding + exclusive zones already claimed by other surfaces, ensuring no overlap will happen. + This is the default behavior - This is the default behavior, if you want a zone to not be automatically moved, - explicitly call this with 0 as parameter. + The full area (anchor_rect_full_area) is the whole space of the screen, ensuring + that the surface will touch all the screen edges corresponding to each anchor + edge that was asked, even if this would result in overlapping surfaces. - +