mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-06-04 01:28:35 -04:00
Expose setDesiredSize to the C++ API
Making it possible for clients to call setDesiredSize directly, The idea is that under Wayland, the panel calls this intead of setGeometry, not trying to set an abosulute geometry that might cause the panel sized wrongly, but just sets an hint which will ensure the panel won't overlap another one used by https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5437 CCBUG:489703
This commit is contained in:
parent
b37ac92e9f
commit
80d5e3c935
@ -32,6 +32,7 @@ public:
|
|||||||
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
||||||
Window::Layer layer = Window::LayerTop;
|
Window::Layer layer = Window::LayerTop;
|
||||||
QMargins margins;
|
QMargins margins;
|
||||||
|
QSize desiredSize = QSize(0, 0);
|
||||||
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
||||||
bool closeOnDismissed = true;
|
bool closeOnDismissed = true;
|
||||||
};
|
};
|
||||||
@ -97,6 +98,21 @@ QMargins Window::margins() const
|
|||||||
return d->margins;
|
return d->margins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::setDesiredSize(const QSize &size)
|
||||||
|
{
|
||||||
|
if (size == d->desiredSize) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->desiredSize = size;
|
||||||
|
Q_EMIT desiredSizeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize Window::desiredSize() const
|
||||||
|
{
|
||||||
|
return d->desiredSize;
|
||||||
|
}
|
||||||
|
|
||||||
void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity)
|
void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity)
|
||||||
{
|
{
|
||||||
if (d->keyboardInteractivity != interactivity) {
|
if (d->keyboardInteractivity != interactivity) {
|
||||||
|
@ -86,6 +86,9 @@ public:
|
|||||||
void setMargins(const QMargins &margins);
|
void setMargins(const QMargins &margins);
|
||||||
QMargins margins() const;
|
QMargins margins() const;
|
||||||
|
|
||||||
|
void setDesiredSize(const QSize &size);
|
||||||
|
QSize desiredSize() const;
|
||||||
|
|
||||||
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
|
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
|
||||||
KeyboardInteractivity keyboardInteractivity() const;
|
KeyboardInteractivity keyboardInteractivity() const;
|
||||||
|
|
||||||
@ -127,6 +130,7 @@ Q_SIGNALS:
|
|||||||
void exclusionZoneChanged();
|
void exclusionZoneChanged();
|
||||||
void exclusiveEdgeChanged();
|
void exclusiveEdgeChanged();
|
||||||
void marginsChanged();
|
void marginsChanged();
|
||||||
|
void desiredSizeChanged();
|
||||||
void keyboardInteractivityChanged();
|
void keyboardInteractivityChanged();
|
||||||
void layerChanged();
|
void layerChanged();
|
||||||
|
|
||||||
|
@ -44,7 +44,11 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
setAnchor(m_interface->anchors());
|
setAnchor(m_interface->anchors());
|
||||||
connect(m_interface, &Window::anchorsChanged, this, [this]() {
|
connect(m_interface, &Window::anchorsChanged, this, [this]() {
|
||||||
setAnchor(m_interface->anchors());
|
setAnchor(m_interface->anchors());
|
||||||
setDesiredSize(m_window->windowContentGeometry().size());
|
if (m_interface->desiredSize().isNull()) {
|
||||||
|
setDesiredSize(m_window->windowContentGeometry().size());
|
||||||
|
} else {
|
||||||
|
setDesiredSize(m_interface->desiredSize());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setExclusiveZone(m_interface->exclusionZone());
|
setExclusiveZone(m_interface->exclusionZone());
|
||||||
@ -61,12 +65,22 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
setMargins(m_interface->margins());
|
setMargins(m_interface->margins());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(m_interface, &Window::desiredSizeChanged, this, [this]() {
|
||||||
|
if (!m_interface->desiredSize().isNull()) {
|
||||||
|
setDesiredSize(m_interface->desiredSize());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||||
connect(m_interface, &Window::keyboardInteractivityChanged, this, [this]() {
|
connect(m_interface, &Window::keyboardInteractivityChanged, this, [this]() {
|
||||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||||
});
|
});
|
||||||
|
|
||||||
setDesiredSize(window->windowContentGeometry().size());
|
if (m_interface->desiredSize().isNull()) {
|
||||||
|
setDesiredSize(window->windowContentGeometry().size());
|
||||||
|
} else {
|
||||||
|
setDesiredSize(m_interface->desiredSize());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandLayerSurface::~QWaylandLayerSurface()
|
QWaylandLayerSurface::~QWaylandLayerSurface()
|
||||||
@ -174,12 +188,16 @@ void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setDesiredSize(geometry.size());
|
if (m_interface->desiredSize().isNull()) {
|
||||||
|
setDesiredSize(geometry.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
||||||
{
|
{
|
||||||
setDesiredSize(size);
|
if (m_interface->desiredSize().isNull()) {
|
||||||
|
setDesiredSize(size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user