mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-05-25 09:30:22 -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) it's quite quick and dirty mostly to understand if we do want to push for something along the lines
This commit is contained in:
parent
f1e50306f8
commit
ad5246f0d0
@ -28,6 +28,7 @@ public:
|
|||||||
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;
|
int32_t exclusionZone = 0;
|
||||||
|
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;
|
||||||
QMargins margins;
|
QMargins margins;
|
||||||
@ -68,6 +69,21 @@ int32_t 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) {
|
||||||
|
@ -33,6 +33,7 @@ public:
|
|||||||
~Window() override;
|
~Window() override;
|
||||||
|
|
||||||
enum Anchor {
|
enum Anchor {
|
||||||
|
AnchorNone = 0,
|
||||||
AnchorTop = 1, ///< The top edge of the anchor rectangle
|
AnchorTop = 1, ///< The top edge of the anchor rectangle
|
||||||
AnchorBottom = 2, ///< The bottom edge of the anchor rectangle
|
AnchorBottom = 2, ///< The bottom edge of the anchor rectangle
|
||||||
AnchorLeft = 4, ///< The left edge of the anchor rectangle
|
AnchorLeft = 4, ///< The left edge of the anchor rectangle
|
||||||
@ -79,6 +80,9 @@ public:
|
|||||||
void setExclusiveZone(int32_t zone);
|
void setExclusiveZone(int32_t zone);
|
||||||
int32_t exclusionZone() const;
|
int32_t 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;
|
||||||
|
|
||||||
@ -121,6 +125,7 @@ public:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void anchorsChanged();
|
void anchorsChanged();
|
||||||
void exclusionZoneChanged();
|
void exclusionZoneChanged();
|
||||||
|
void exclusiveEdgeChanged();
|
||||||
void marginsChanged();
|
void marginsChanged();
|
||||||
void keyboardInteractivityChanged();
|
void keyboardInteractivityChanged();
|
||||||
void layerChanged();
|
void layerChanged();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
namespace LayerShellQt
|
namespace LayerShellQt
|
||||||
{
|
{
|
||||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
||||||
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(4)
|
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(5)
|
||||||
, m_xdgActivation(new QWaylandXdgActivationV1)
|
, m_xdgActivation(new QWaylandXdgActivationV1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,10 @@ 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]() {
|
||||||
@ -127,6 +131,13 @@ void QWaylandLayerSurface::setExclusiveZone(int32_t zone)
|
|||||||
set_exclusive_zone(zone);
|
set_exclusive_zone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
|
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
|
||||||
|
@ -36,6 +36,7 @@ public:
|
|||||||
|
|
||||||
void setAnchor(uint32_t anchor);
|
void setAnchor(uint32_t anchor);
|
||||||
void setExclusiveZone(int32_t zone);
|
void setExclusiveZone(int32_t 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);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zwlr_layer_shell_v1" version="4">
|
<interface name="zwlr_layer_shell_v1" version="5">
|
||||||
<description summary="create surfaces that are layers of the desktop">
|
<description summary="create surfaces that are layers of the desktop">
|
||||||
Clients can use this interface to assign the surface_layer role to
|
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
|
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||||
@ -100,7 +100,7 @@
|
|||||||
</request>
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zwlr_layer_surface_v1" version="4">
|
<interface name="zwlr_layer_surface_v1" version="5">
|
||||||
<description summary="layer metadata interface">
|
<description summary="layer metadata interface">
|
||||||
An interface that may be implemented by a wl_surface, for surfaces that
|
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
|
are designed to be rendered as a layer of a stacked desktop-like
|
||||||
@ -367,6 +367,7 @@
|
|||||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||||
|
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
<enum name="anchor" bitfield="true">
|
<enum name="anchor" bitfield="true">
|
||||||
@ -386,5 +387,21 @@
|
|||||||
</description>
|
</description>
|
||||||
<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 exclusive
|
||||||
|
edge will be automatically deduced from anchor points when possible,
|
||||||
|
but when the surface is anchored to a corner, it will be necessary
|
||||||
|
to set it explicitly to disambiguate, as it is not possible to deduce
|
||||||
|
which one of the two corner edges should be used.
|
||||||
|
|
||||||
|
The edge must be one the surface is anchored to, otherwise the
|
||||||
|
invalid_exclusive_edge protocol error will be raised.
|
||||||
|
</description>
|
||||||
|
<arg name="edge" type="uint"/>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
Loading…
Reference in New Issue
Block a user