diff --git a/abstract_client.cpp b/abstract_client.cpp index d24efc4e48..db76e4558b 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -3106,6 +3106,8 @@ QSize AbstractClient::adjustedSize() const /** * Constrains the client size @p size according to a set of the window's size hints. + * + * Default implementation applies only minimum and maximum size constraints. */ QSize AbstractClient::constrainClientSize(const QSize &size, SizeMode mode) const { @@ -3123,6 +3125,12 @@ QSize AbstractClient::constrainClientSize(const QSize &size, SizeMode mode) cons height = 1; } + const QSize minimumSize = minSize(); + const QSize maximumSize = maxSize(); + + width = qBound(minimumSize.width(), width, maximumSize.width()); + height = qBound(minimumSize.height(), height, maximumSize.height()); + return QSize(width, height); } diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp index 617756242c..4118b91b76 100644 --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -345,6 +345,22 @@ QSize XdgShellClient::clientSize() const return m_windowGeometry.size().boundedTo(boundingRect.size()); } +QSize XdgShellClient::minSize() const +{ + if (m_xdgShellToplevel) { + return rules()->checkMinSize(m_xdgShellToplevel->minimumSize()); + } + return QSize(0, 0); +} + +QSize XdgShellClient::maxSize() const +{ + if (m_xdgShellToplevel) { + return rules()->checkMaxSize(m_xdgShellToplevel->maximumSize()); + } + return QSize(INT_MAX, INT_MAX); +} + void XdgShellClient::debug(QDebug &stream) const { stream.nospace(); diff --git a/xdgshellclient.h b/xdgshellclient.h index 41c59bbbef..fd300c3992 100644 --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -63,6 +63,8 @@ public: QStringList activities() const override; QPoint clientContentPos() const override; QSize clientSize() const override; + QSize minSize() const override; + QSize maxSize() const override; QRect transparentRect() const override; NET::WindowType windowType(bool direct = false, int supported_types = 0) const override; void debug(QDebug &stream) const override;