47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
|
From 760abe1939f6afc146de2c5172b27b347043f327 Mon Sep 17 00:00:00 2001
|
||
|
From: David Edmundson <davidedmundson@kde.org>
|
||
|
Date: Fri, 24 Jul 2020 16:35:09 +0100
|
||
|
Subject: [PATCH] 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
|
||
|
Pick-to: 5.15
|
||
|
---
|
||
|
|
||
|
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
|
||
|
index cfcc735..f7647a4 100644
|
||
|
--- a/src/client/qwaylandwindow.cpp
|
||
|
+++ b/src/client/qwaylandwindow.cpp
|
||
|
@@ -86,6 +86,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
|
||
|
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();
|
||
|
@@ -184,8 +186,6 @@ void QWaylandWindow::initWindow()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- mScale = waylandScreen()->scale();
|
||
|
-
|
||
|
// 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.
|