summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2020-07-24 16:35:09 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-08-26 15:32:28 +0000
commit18ab3edaf2a4cdd1e9df6e166cf51a69a9785ecd (patch)
tree37583cbe07abbaf0c22ab0cf6135f24148c6658f
parent7d7ac7f0a4bd6a7956448ddb0ba44c12755dca2e (diff)
downloadqtwayland-18ab3edaf2a4cdd1e9df6e166cf51a69a9785ecd.tar.gz
Client: Initialize mScale on creation instead of on show
At the time of creating a QPlatformWindow we will have a QScreen assigned. It may not be the right one until we get a screen_entered event, pointing instead to the primary screen. When we get the screen_entered event we get the correct scale and call handleWindowScreenChanged. However if it's the same screen as before QWindowPrivate::setTopLevelScreen will no-op because from it's POV the screen hasn't changed at all. This leaves the window having the scale change without any notification. This is notable with QQuickWidget which creates an FBO very early on before the window is shown. This would then use the devicePixelRatio of 1 as it is currently unset and then not get any change notification. Change-Id: Ia7e4072e0bd900abc558bf8930fef4e1e7d2c553 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 5ecf5215737ba3343a10310c0dff08763af737bc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/client/qwaylandwindow.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 7c2815f6..1127a07d 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -86,6 +86,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display)
mFrameCallbackTimeout = frameCallbackTimeout;
}
+ mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 if we don't have a real screen
+
static WId id = 1;
mWindowId = id++;
initializeWlSurface();
@@ -182,8 +184,6 @@ void QWaylandWindow::initWindow()
}
}
- mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 if we don't have a real screen
-
// Enable high-dpi rendering. Scale() returns the screen scale factor and will
// typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale()
// to inform the compositor that high-resolution buffers will be provided.