From 79cc2f159c6211dbdb1aebd326b58d82e452b53c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 30 Jun 2022 08:07:44 +0200 Subject: [PATCH] client: Respect initial size when only one component is set We would ignore the initial size of the window if only either the width or height were set and the other was left at 0. Instead of using isEmpty() for checking if the geometry is valid, we check the width and height individually. Pick-to: 6.4 Task-number: QTBUG-66818 Change-Id: Ib2a22443fd6b88175599da08651fa72c921ea485 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 85266422d42..a740559b774 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -154,10 +154,13 @@ void QWaylandWindow::initWindow() setWindowFlags(window()->flags()); QRect geometry = windowGeometry(); - if (geometry.isEmpty()) - setGeometry_helper(defaultGeometry()); - else - setGeometry_helper(geometry); + QRect defaultGeometry = this->defaultGeometry(); + if (geometry.width() <= 0) + geometry.setWidth(defaultGeometry.width()); + if (geometry.height() <= 0) + geometry.setHeight(defaultGeometry.height()); + + setGeometry_helper(geometry); setMask(window()->mask()); if (mShellSurface) mShellSurface->requestWindowStates(window()->windowStates());