diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-08-15 16:49:54 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2018-08-17 15:22:18 +0000 |
commit | c7e775aef78b655666916bba15196c89dbf0b43d (patch) | |
tree | d61cc2300274b7481ad4151cca990eb4d98f1008 /src/compositor/extensions/qwaylandxdgshell.cpp | |
parent | 192a8364a983ceff7a7d9f2a33161e1da738ed70 (diff) |
Compositor xdg-shell: Respect min and max size
[ChangeLog][Compositor] xdg-shell minimum and maximum sizes are now respected
when resizing.
Change-Id: Iaf6a2bd283117e948fda6693530e08f68f755a17
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor/extensions/qwaylandxdgshell.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshell.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp index 205269a88..175caea62 100644 --- a/src/compositor/extensions/qwaylandxdgshell.cpp +++ b/src/compositor/extensions/qwaylandxdgshell.cpp @@ -935,9 +935,14 @@ QSize QWaylandXdgToplevel::sizeForResize(const QSizeF &size, const QPointF &delt else if (edges & Qt::BottomEdge) height += delta.y(); - //TODO: use minSize given by the client here instead - QSizeF newSize(qMax(width, 1.0), qMax(height, 1.0)); - return newSize.toSize(); + QSize newSize = QSize(width, height) + .expandedTo(minSize()) + .expandedTo({1, 1}); // We don't want to send a size of (0,0) as that means that the client decides + + if (maxSize().isValid()) + newSize = newSize.boundedTo(maxSize()); + + return newSize; } /*! |