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 <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Youngjin Kim 2021-03-19 15:46:08 +09:00 committed by Beomjoong Yun
parent 0ccd3105ff
commit 1f2c1062c6
2 changed files with 7 additions and 1 deletions

View File

@ -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();

View File

@ -215,6 +215,7 @@ signals:
protected:
virtual void doHandleFrameCallback();
virtual QRect defaultGeometry() const;
void sendExposeEvent(const QRect &rect);
QWaylandDisplay *mDisplay = nullptr;