Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:thiagomacieira:branches:openSUSE:Factory
libqt5-qtbase
3006-high-dpi-Set-screen-on-QWindow-setGeometry...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3006-high-dpi-Set-screen-on-QWindow-setGeometry.patch of Package libqt5-qtbase
From bafc80ecff31646b73b94b7a36eb53878aba70f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io> Date: Mon, 25 May 2020 15:11:34 +0200 Subject: [PATCH 3006/3009] high-dpi: Set screen on QWindow::setGeometry() Keep (requested) geometry and screen in sync, which is required for correct high-dpi scaling. The platform plugin can still override with new geometry (and screen), as usual. This has previously been fixed/worked around for QDialog, see QTBUG-52735. That fix can now be removed in favor of this change in QWindow. Change-Id: Ieadb1bfee5fb966c5c2052e9daa5ba124a87f3cd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit e8fabb29462e6ee268bde5267e3d7bca23addbb2) --- src/gui/kernel/qwindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index e79ac2d6de..0e44c384be 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -523,6 +523,13 @@ void QWindowPrivate::create(bool recursive, WId nativeHandle) if (q->parent()) q->parent()->create(); + // QPlatformWindow will poll geometry() during construction below. Set the + // screen here so that high-dpi scaling will use the correct scale factor. + if (q->isTopLevel()) { + if (QScreen *screen = screenForGeometry(geometry)) + setTopLevelScreen(screen, false); + } + QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); platformWindow = nativeHandle ? platformIntegration->createForeignWindow(q, nativeHandle) : platformIntegration->createPlatformWindow(q); @@ -1731,8 +1738,11 @@ void QWindow::setGeometry(const QRect &rect) d->positionPolicy = QWindowPrivate::WindowFrameExclusive; if (d->platformWindow) { - QRect nativeRect; QScreen *newScreen = d->screenForGeometry(rect); + if (newScreen && isTopLevel()) + d->setTopLevelScreen(newScreen, true); + + QRect nativeRect; if (newScreen && isTopLevel()) nativeRect = QHighDpi::toNativePixels(rect, newScreen); else -- 2.29.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor