5.8 backport: Ensure a pixel density of at least 1 for Qt::AA_EnableHighDpiScaling (QTBUG-56140)

This commit is contained in:
Rex Dieter 2017-02-09 07:50:19 -06:00
parent 9e2e7ad9bd
commit 8c7fe210fe
3 changed files with 62 additions and 6 deletions

View File

@ -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);

View File

@ -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 <rdieter@fedoraproject.org> - 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 <rdieter@fedoraproject.org> - 5.7.1-13
- Broken window scaling (#1381828)

View File

@ -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);