diff --git a/abstract_client.h b/abstract_client.h --- a/abstract_client.h +++ b/abstract_client.h @@ -653,6 +653,8 @@ /** * Constrains the desired client size @p size according to a set the window's size hints. + * + * Default implementation applies only minimum and maximum size constraints. */ virtual QSize constrainClientSize(const QSize &size, SizeMode mode = SizeModeAny) const; /** diff --git a/abstract_client.cpp b/abstract_client.cpp --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -3140,6 +3140,9 @@ height = 1; } + width = qBound(minSize().width(), width, maxSize().width()); + height = qBound(minSize().height(), height, maxSize().height()); + return QSize(width, height); } diff --git a/xdgshellclient.h b/xdgshellclient.h --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -62,6 +62,8 @@ 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; diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -336,6 +336,24 @@ return m_windowGeometry.size().boundedTo(boundingRect.size()); } +QSize XdgShellClient::minSize() const +{ + // Window rules are applied only to xdg-toplevel clients. + if (m_xdgShellSurface) { + return rules()->checkMinSize(m_xdgShellSurface->minimumSize()); + } + return QSize(0, 0); +} + +QSize XdgShellClient::maxSize() const +{ + // Window rules are applied only to xdg-toplevel clients. + if (m_xdgShellSurface) { + return rules()->checkMaxSize(m_xdgShellSurface->maximumSize()); + } + return QSize(INT_MAX, INT_MAX); +} + void XdgShellClient::debug(QDebug &stream) const { stream.nospace();