mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-05-27 10:30:21 -04:00
Add a new setExclusiveEdge call in the protocol
This can be used to disambiguate the exclusive edge when the anchors are on a corner (so there would be 2 candidates)
This commit is contained in:
parent
feeea2fec6
commit
d33befa740
@ -27,7 +27,7 @@ public:
|
|||||||
QWindow *parentWindow;
|
QWindow *parentWindow;
|
||||||
QString scope = QStringLiteral("window");
|
QString scope = QStringLiteral("window");
|
||||||
Window::Anchors anchors = {Window::AnchorTop | Window::AnchorBottom | Window::AnchorLeft | Window::AnchorRight};
|
Window::Anchors anchors = {Window::AnchorTop | Window::AnchorBottom | Window::AnchorLeft | Window::AnchorRight};
|
||||||
int32_t exclusionZone = 0;
|
QSize exclusionZone;
|
||||||
Window::Anchor exclusiveEdge = Window::AnchorNone;
|
Window::Anchor exclusiveEdge = Window::AnchorNone;
|
||||||
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
||||||
Window::Layer layer = Window::LayerTop;
|
Window::Layer layer = Window::LayerTop;
|
||||||
@ -56,7 +56,7 @@ Window::Anchors Window::anchors() const
|
|||||||
return d->anchors;
|
return d->anchors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setExclusiveZone(int32_t zone)
|
void Window::setExclusiveZone(const QSize &zone)
|
||||||
{
|
{
|
||||||
if (d->exclusionZone != zone) {
|
if (d->exclusionZone != zone) {
|
||||||
d->exclusionZone = zone;
|
d->exclusionZone = zone;
|
||||||
@ -64,26 +64,11 @@ void Window::setExclusiveZone(int32_t zone)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Window::exclusionZone() const
|
QSize Window::exclusionZone() const
|
||||||
{
|
{
|
||||||
return d->exclusionZone;
|
return d->exclusionZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setExclusiveEdge(Window::Anchor edge)
|
|
||||||
{
|
|
||||||
if (d->exclusiveEdge == edge) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->exclusiveEdge = edge;
|
|
||||||
Q_EMIT exclusiveEdgeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
Window::Anchor Window::exclusiveEdge() const
|
|
||||||
{
|
|
||||||
return d->exclusiveEdge;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setMargins(const QMargins &margins)
|
void Window::setMargins(const QMargins &margins)
|
||||||
{
|
{
|
||||||
if (d->margins != margins) {
|
if (d->margins != margins) {
|
||||||
|
@ -24,7 +24,7 @@ class LAYERSHELLQT_EXPORT Window : public QObject
|
|||||||
Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged)
|
Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged)
|
||||||
Q_PROPERTY(QString scope READ scope WRITE setScope)
|
Q_PROPERTY(QString scope READ scope WRITE setScope)
|
||||||
Q_PROPERTY(QMargins margins READ margins WRITE setMargins NOTIFY marginsChanged)
|
Q_PROPERTY(QMargins margins READ margins WRITE setMargins NOTIFY marginsChanged)
|
||||||
Q_PROPERTY(qint32 exclusionZone READ exclusionZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged)
|
Q_PROPERTY(QSize exclusionZone READ exclusionZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged)
|
||||||
Q_PROPERTY(Layer layer READ layer WRITE setLayer NOTIFY layerChanged)
|
Q_PROPERTY(Layer layer READ layer WRITE setLayer NOTIFY layerChanged)
|
||||||
Q_PROPERTY(KeyboardInteractivity keyboardInteractivity READ keyboardInteractivity WRITE setKeyboardInteractivity NOTIFY keyboardInteractivityChanged)
|
Q_PROPERTY(KeyboardInteractivity keyboardInteractivity READ keyboardInteractivity WRITE setKeyboardInteractivity NOTIFY keyboardInteractivityChanged)
|
||||||
Q_PROPERTY(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
|
Q_PROPERTY(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
|
||||||
@ -77,11 +77,8 @@ public:
|
|||||||
void setAnchors(Anchors anchor);
|
void setAnchors(Anchors anchor);
|
||||||
Anchors anchors() const;
|
Anchors anchors() const;
|
||||||
|
|
||||||
void setExclusiveZone(int32_t zone);
|
void setExclusiveZone(const QSize &zone);
|
||||||
int32_t exclusionZone() const;
|
QSize exclusionZone() const;
|
||||||
|
|
||||||
void setExclusiveEdge(Window::Anchor edge);
|
|
||||||
Window::Anchor exclusiveEdge() const;
|
|
||||||
|
|
||||||
void setMargins(const QMargins &margins);
|
void setMargins(const QMargins &margins);
|
||||||
QMargins margins() const;
|
QMargins margins() const;
|
||||||
|
@ -48,10 +48,6 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
connect(m_interface, &Window::exclusionZoneChanged, this, [this]() {
|
connect(m_interface, &Window::exclusionZoneChanged, this, [this]() {
|
||||||
setExclusiveZone(m_interface->exclusionZone());
|
setExclusiveZone(m_interface->exclusionZone());
|
||||||
});
|
});
|
||||||
setExclusiveEdge(m_interface->exclusiveEdge());
|
|
||||||
connect(m_interface, &Window::exclusiveEdgeChanged, this, [this]() {
|
|
||||||
setExclusiveEdge(m_interface->exclusiveEdge());
|
|
||||||
});
|
|
||||||
|
|
||||||
setMargins(m_interface->margins());
|
setMargins(m_interface->margins());
|
||||||
connect(m_interface, &Window::marginsChanged, this, [this]() {
|
connect(m_interface, &Window::marginsChanged, this, [this]() {
|
||||||
@ -126,16 +122,9 @@ void QWaylandLayerSurface::setAnchor(uint anchor)
|
|||||||
setWindowGeometry(window()->windowContentGeometry());
|
setWindowGeometry(window()->windowContentGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setExclusiveZone(int32_t zone)
|
void QWaylandLayerSurface::setExclusiveZone(const QSize &zone)
|
||||||
{
|
{
|
||||||
set_exclusive_zone(zone);
|
set_exclusive_zone(zone.width(), zone.height());
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandLayerSurface::setExclusiveEdge(uint32_t edge)
|
|
||||||
{
|
|
||||||
if (zwlr_layer_surface_v1_get_version(object()) >= ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_EDGE_SINCE_VERSION) {
|
|
||||||
set_exclusive_edge(edge);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setMargins(const QMargins &margins)
|
void QWaylandLayerSurface::setMargins(const QMargins &margins)
|
||||||
|
@ -35,8 +35,7 @@ public:
|
|||||||
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
|
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
|
||||||
|
|
||||||
void setAnchor(uint32_t anchor);
|
void setAnchor(uint32_t anchor);
|
||||||
void setExclusiveZone(int32_t zone);
|
void setExclusiveZone(const QSize &zone);
|
||||||
void setExclusiveEdge(uint32_t edge);
|
|
||||||
void setMargins(const QMargins &margins);
|
void setMargins(const QMargins &margins);
|
||||||
void setKeyboardInteractivity(uint32_t interactivity);
|
void setKeyboardInteractivity(uint32_t interactivity);
|
||||||
void setLayer(uint32_t layer);
|
void setLayer(uint32_t layer);
|
||||||
|
@ -184,7 +184,8 @@
|
|||||||
|
|
||||||
Exclusive zone is double-buffered, see wl_surface.commit.
|
Exclusive zone is double-buffered, see wl_surface.commit.
|
||||||
</description>
|
</description>
|
||||||
<arg name="zone" type="int"/>
|
<arg name="horizontal_zone" type="int"/>
|
||||||
|
<arg name="vertical_zone" type="int"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="set_margin">
|
<request name="set_margin">
|
||||||
@ -387,19 +388,5 @@
|
|||||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<!-- Version 5 additions -->
|
|
||||||
|
|
||||||
<request name="set_exclusive_edge" since="5">
|
|
||||||
<description summary="set the edge the exclusive zone will be applied to">
|
|
||||||
Requests an edge for the exclusive zone to apply.
|
|
||||||
The edge must be one the surface is anchored to, otherwise a protocol
|
|
||||||
error will be raised.
|
|
||||||
The exclusive edge will be automatically deduced from anchor points
|
|
||||||
when possible, but when when the surface is anchored to a corner,
|
|
||||||
it will be necessary to set it explicitly to disambiguate, as is not
|
|
||||||
possible to deduce which one of the two corner edges should be used.
|
|
||||||
</description>
|
|
||||||
<arg name="edge" type="uint"/>
|
|
||||||
</request>
|
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
Loading…
Reference in New Issue
Block a user