mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-05-25 17:40:21 -04:00
guard setDesiredSize with a bool
This commit is contained in:
parent
826b9362c9
commit
5475de8b29
@ -62,7 +62,9 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
||||
});
|
||||
|
||||
connect(m_interface, &Window::desiredSizeChanged, this, [this]() {
|
||||
setDesiredSize(m_interface->desiredSize());
|
||||
if (!m_settingDesiredSize) {
|
||||
setDesiredSize(m_interface->desiredSize());
|
||||
}
|
||||
});
|
||||
|
||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||
@ -125,6 +127,12 @@ void QWaylandLayerSurface::applyConfigure()
|
||||
|
||||
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
||||
{
|
||||
// This guards setDesiredSize to avoid the connection between
|
||||
// m_interface::desiredSizeChanged and this takes effect when
|
||||
// we call m_interface->setDesiredSize from here
|
||||
m_settingDesiredSize = true;
|
||||
m_interface->setDesiredSize(size);
|
||||
|
||||
const bool horizontallyConstrained = m_interface->anchors().testFlags({Window::AnchorLeft, Window::AnchorRight});
|
||||
const bool verticallyConstrained = m_interface->anchors().testFlags({Window::AnchorTop, Window::AnchorBottom});
|
||||
|
||||
@ -136,6 +144,7 @@ void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
||||
effectiveSize.setHeight(0);
|
||||
}
|
||||
set_size(effectiveSize.width(), effectiveSize.height());
|
||||
m_settingDesiredSize = false;
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::setAnchor(uint anchor)
|
||||
|
@ -64,6 +64,7 @@ private:
|
||||
QSize m_pendingSize;
|
||||
QString m_activationToken;
|
||||
|
||||
bool m_settingDesiredSize = false;
|
||||
bool m_configured = false;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
||||
bool m_configuring = false;
|
||||
|
Loading…
Reference in New Issue
Block a user