Commit 2b120e07 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[wayland] Honor xdg-toplevel size constraints

This change ensures that we honor surface size constraints specified by
xdg-toplevel clients.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision:
parent c3abe87f
......@@ -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);
......@@ -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
......@@ -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;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment