From 1f2c1062c63b099c1e5ab8a7da8144ce1abf68de Mon Sep 17 00:00:00 2001 From: Youngjin Kim Date: Fri, 19 Mar 2021 15:46:08 +0900 Subject: [PATCH] Fix inconsistent window geometry on null window Add virtual QtWaylandClient::QWaylandWindow::defaultGeometry(). So this method allows a client to set the desired default geometry. Otherwise, if the geometry of the window is null, the window with the hard-coded geometry size will be displayed for a while when starting a client application. Change-Id: I18c50f8f390c2b8e1a2c3d8e4641b896df4d6c3f Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 ++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f5dbd02af23..4d59a2b7802 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -194,7 +194,7 @@ void QWaylandWindow::initWindow() setWindowFlags(window()->flags()); QRect geometry = windowGeometry(); if (geometry.isEmpty()) - setGeometry_helper(QRect(QPoint(), QSize(500,500))); + setGeometry_helper(defaultGeometry()); else setGeometry_helper(geometry); setMask(window()->mask()); @@ -329,6 +329,11 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon) mWindowDecoration->update(); } +QRect QWaylandWindow::defaultGeometry() const +{ + return QRect(QPoint(), QSize(500,500)); +} + void QWaylandWindow::setGeometry_helper(const QRect &rect) { QSize minimum = windowMinimumSize(); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index b82bbe99f21..5f134568b39 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -215,6 +215,7 @@ signals: protected: virtual void doHandleFrameCallback(); + virtual QRect defaultGeometry() const; void sendExposeEvent(const QRect &rect); QWaylandDisplay *mDisplay = nullptr;