From 8c7fe210fe0bfbc20ec8adffd612f7baa80ccb5f Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Thu, 9 Feb 2017 07:50:19 -0600 Subject: [PATCH] 5.8 backport: Ensure a pixel density of at least 1 for Qt::AA_EnableHighDpiScaling (QTBUG-56140) --- qt5-qtbase-5.8-QTBUG-56140.patch | 48 ++++++++++++++++++++++++++++++++ qt5-qtbase.spec | 11 ++++++-- qtbase-hidpi_scale_at_192.patch | 9 +++--- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 qt5-qtbase-5.8-QTBUG-56140.patch diff --git a/qt5-qtbase-5.8-QTBUG-56140.patch b/qt5-qtbase-5.8-QTBUG-56140.patch new file mode 100644 index 0000000..e3024f7 --- /dev/null +++ b/qt5-qtbase-5.8-QTBUG-56140.patch @@ -0,0 +1,48 @@ +diff -up qtbase-opensource-src-5.7.1/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp.0295 qtbase-opensource-src-5.7.1/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp +--- qtbase-opensource-src-5.7.1/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp.0295 2017-02-09 07:41:56.976681266 -0600 ++++ qtbase-opensource-src-5.7.1/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp 2017-02-09 07:43:31.812667108 -0600 +@@ -222,7 +222,7 @@ QDpi QEGLDeviceIntegration::logicalDpi() + + qreal QEGLDeviceIntegration::pixelDensity() const + { +- return qRound(logicalDpi().first / qreal(100)); ++ return qMax(1, qRound(logicalDpi().first / qreal(100))); + } + + Qt::ScreenOrientation QEGLDeviceIntegration::nativeOrientation() const +diff -up qtbase-opensource-src-5.7.1/src/plugins/platforms/windows/qwindowsscreen.cpp.0295 qtbase-opensource-src-5.7.1/src/plugins/platforms/windows/qwindowsscreen.cpp +--- qtbase-opensource-src-5.7.1/src/plugins/platforms/windows/qwindowsscreen.cpp.0295 2016-12-01 02:17:04.000000000 -0600 ++++ qtbase-opensource-src-5.7.1/src/plugins/platforms/windows/qwindowsscreen.cpp 2017-02-09 07:41:56.976681266 -0600 +@@ -264,7 +264,7 @@ qreal QWindowsScreen::pixelDensity() con + // the pixel density since it is reflects the Windows UI scaling. + // High DPI auto scaling should be disabled when the user chooses + // small fonts on a High DPI monitor, resulting in lower logical DPI. +- return qRound(logicalDpi().first / 96); ++ return qMax(1, qRound(logicalDpi().first / 96)); + } + + /*! +diff -up qtbase-opensource-src-5.7.1/src/plugins/platforms/winrt/qwinrtscreen.cpp.0295 qtbase-opensource-src-5.7.1/src/plugins/platforms/winrt/qwinrtscreen.cpp +--- qtbase-opensource-src-5.7.1/src/plugins/platforms/winrt/qwinrtscreen.cpp.0295 2016-12-01 02:17:04.000000000 -0600 ++++ qtbase-opensource-src-5.7.1/src/plugins/platforms/winrt/qwinrtscreen.cpp 2017-02-09 07:41:56.976681266 -0600 +@@ -644,7 +644,7 @@ QDpi QWinRTScreen::logicalDpi() const + qreal QWinRTScreen::pixelDensity() const + { + Q_D(const QWinRTScreen); +- return qRound(d->logicalDpi / 96); ++ return qMax(1, qRound(d->logicalDpi / 96)); + } + + qreal QWinRTScreen::scaleFactor() const +diff -up qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp.0295 qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp +--- qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp.0295 2016-12-01 02:17:04.000000000 -0600 ++++ qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp 2017-02-09 07:41:56.977681276 -0600 +@@ -633,7 +633,7 @@ void QXcbScreen::updateGeometry(const QR + m_sizeMillimeters = sizeInMillimeters(xGeometry.size(), virtualDpi()); + + qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); +- m_pixelDensity = qRound(dpi/96); ++ m_pixelDensity = qMax(1, qRound(dpi/96)); + m_geometry = QRect(xGeometry.topLeft(), xGeometry.size()); + m_availableGeometry = xGeometry & m_virtualDesktop->workArea(); + QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index cd0c89e..22690b5 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -66,7 +66,7 @@ BuildRequires: pkgconfig(libsystemd) Name: qt5-qtbase Summary: Qt5 - QtBase components Version: 5.7.1 -Release: 13%{?dist} +Release: 14%{?dist} # See LGPL_EXCEPTIONS.txt, for exception details License: LGPLv2 with exceptions or GPLv3 with exceptions @@ -129,10 +129,13 @@ Patch63: qt5-qtbase-5.7.1-openssl11.patch Patch64: qt5-qtbase-5.7.1-firebird.patch ## upstream patches -# 5.8 branch +## 5.8 branch # https://bugzilla.redhat.com/show_bug.cgi?id=1403500 # https://bugreports.qt.io/browse/QTBUG-55583 Patch100: qt5-qtbase-5.8-QTBUG-55583.patch +# Ensure a pixel density of at least 1 for Qt::AA_EnableHighDpiScaling +# https://bugreports.qt.io/browse/QTBUG-56140 +Patch101: qt5-qtbase-5.8-QTBUG-56140.patch # Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires. # Those themes are there for platform integration. If the required libraries are @@ -366,6 +369,7 @@ Qt5 libraries used for drawing widgets and OpenGL items. %patch4 -p1 -b .QTBUG-35459 %patch100 -p1 -b .QTBUG-55583 +%patch101 -p1 -b .QTBUG-56140 %patch50 -p1 -b .QT_VERSION_CHECK %patch51 -p1 -b .hidpi_scale_at_192 @@ -978,6 +982,9 @@ fi %changelog +* Thu Feb 09 2017 Rex Dieter - 5.7.1-14 +- 5.8 backport: Ensure a pixel density of at least 1 for Qt::AA_EnableHighDpiScaling (QTBUG-56140) + * Tue Jan 24 2017 Rex Dieter - 5.7.1-13 - Broken window scaling (#1381828) diff --git a/qtbase-hidpi_scale_at_192.patch b/qtbase-hidpi_scale_at_192.patch index 123f1ae..bd85294 100644 --- a/qtbase-hidpi_scale_at_192.patch +++ b/qtbase-hidpi_scale_at_192.patch @@ -1,11 +1,12 @@ ---- qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp.orig 2017-01-11 11:42:59.544860428 +0100 -+++ qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp 2017-01-11 11:43:51.142956762 +0100 +diff -up qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp.hidpi_scale_at_192 qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp +--- qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp.hidpi_scale_at_192 2017-02-09 07:47:26.060096259 -0600 ++++ qtbase-opensource-src-5.7.1/src/plugins/platforms/xcb/qxcbscreen.cpp 2017-02-09 07:48:11.497567447 -0600 @@ -633,7 +633,7 @@ void QXcbScreen::updateGeometry(const QR m_sizeMillimeters = sizeInMillimeters(xGeometry.size(), virtualDpi()); qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); -- m_pixelDensity = qRound(dpi/96); -+ m_pixelDensity = (int) (dpi/96); // instead of rounding at 1.5, round at 2.0 (same as GNOME) +- m_pixelDensity = qMax(1, qRound(dpi/96)); ++ m_pixelDensity = qMax(1, (int) (dpi/96)); // instead of rounding at 1.5, round at 2.0 (same as GNOME) m_geometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = xGeometry & m_virtualDesktop->workArea(); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry);