Upstream fix: Emit QScreen::geometryChanged when the logical DPI changes

This commit is contained in:
Jan Grulich 2020-09-30 15:35:27 +02:00
parent 7cbf037b48
commit 9d109333a3
2 changed files with 62 additions and 1 deletions

View File

@ -49,7 +49,7 @@ BuildRequires: pkgconfig(libsystemd)
Name: qt5-qtbase
Summary: Qt5 - QtBase components
Version: 5.15.1
Release: 4%{?dist}
Release: 5%{?dist}
# See LGPL_EXCEPTIONS.txt, for exception details
License: LGPLv2 with exceptions or GPLv3 with exceptions
@ -124,6 +124,7 @@ Patch80: qtbase-use-wayland-on-gnome.patch
# glibc stat
## upstream patches
Patch100: qtbase-emit-qscreen-geometry-changed-when-logical-dpi-changes.patch
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
# Those themes are there for platform integration. If the required libraries are
@ -382,6 +383,7 @@ Qt5 libraries used for drawing widgets and OpenGL items.
%endif
## upstream patches
%patch100 -p1 -b .emit-qscreen-geometry-changed-when-logical-dpi-changes
# move some bundled libs to ensure they're not accidentally used
pushd src/3rdparty
@ -1039,6 +1041,9 @@ fi
%changelog
* Wed Sep 30 2020 Jan Grulich <jgrulich@redhat.com> - 5.15.1-5
- Upstream fix: Emit QScreen::geometryChanged when the logical DPI changes
* Tue Sep 29 2020 Yaroslav Fedevych <yaroslav@fedevych.name> - 5.15.1-4
- qt5-qtbase-devel requires vulkan headers

View File

@ -0,0 +1,56 @@
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index d294cc38..dd31e31c 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -3155,13 +3155,14 @@ void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfaceP
bool availableGeometryChanged = e->availableGeometry != s->d_func()->availableGeometry;
s->d_func()->availableGeometry = e->availableGeometry;
- if (geometryChanged) {
- Qt::ScreenOrientation primaryOrientation = s->primaryOrientation();
+ const Qt::ScreenOrientation primaryOrientation = s->primaryOrientation();
+ if (geometryChanged)
s->d_func()->updatePrimaryOrientation();
- emit s->geometryChanged(s->geometry());
+ s->d_func()->emitGeometryChangeSignals(geometryChanged, availableGeometryChanged);
+
+ if (geometryChanged) {
emit s->physicalSizeChanged(s->physicalSize());
- emit s->physicalDotsPerInchChanged(s->physicalDotsPerInch());
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
if (s->primaryOrientation() != primaryOrientation)
@@ -3171,8 +3172,6 @@ void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfaceP
updateFilteredScreenOrientation(s);
}
- s->d_func()->emitGeometryChangeSignals(geometryChanged, availableGeometryChanged);
-
resetCachedDevicePixelRatio();
}
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index df628fcc..a1afc1ba 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -88,6 +88,9 @@ void QScreenPrivate::updateGeometriesWithSignals()
void QScreenPrivate::emitGeometryChangeSignals(bool geometryChanged, bool availableGeometryChanged)
{
Q_Q(QScreen);
+ if (geometryChanged)
+ emit q->geometryChanged(geometry);
+
if (availableGeometryChanged)
emit q->availableGeometryChanged(availableGeometry);
@@ -96,6 +99,9 @@ void QScreenPrivate::emitGeometryChangeSignals(bool geometryChanged, bool availa
for (QScreen* sibling : siblings)
emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
}
+
+ if (geometryChanged)
+ emit q->physicalDotsPerInchChanged(q->physicalDotsPerInch());
}
void QScreenPrivate::setPlatformScreen(QPlatformScreen *screen)