From 43852afb3d0db6b803edcaca58952f9f77c8ac9980c6bc6080dc9fa4a9811bc8 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Wed, 4 Jul 2018 21:54:39 +0000 Subject: [PATCH] Accepting request 620458 from KDE:Qt5 OBS-URL: https://build.opensuse.org/request/show/620458 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=85 --- ...ize-QXcbScreen-s-pixelDensity-values.patch | 35 ++++++++++++++++ ...en-s-physical-DPI-as-logical-DPI-unl.patch | 40 +++++++++++++++++++ libqt5-qtbase.changes | 7 ++++ libqt5-qtbase.spec | 4 +- 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 0001-Sanitize-QXcbScreen-s-pixelDensity-values.patch create mode 100644 0002-xcb-Use-the-screen-s-physical-DPI-as-logical-DPI-unl.patch diff --git a/0001-Sanitize-QXcbScreen-s-pixelDensity-values.patch b/0001-Sanitize-QXcbScreen-s-pixelDensity-values.patch new file mode 100644 index 0000000..ddc021b --- /dev/null +++ b/0001-Sanitize-QXcbScreen-s-pixelDensity-values.patch @@ -0,0 +1,35 @@ +From 75bb439f45608b21781d18170a88aaa2aedefb04 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Fri, 9 Mar 2018 18:28:00 +0100 +Subject: [PATCH 1/2] Sanitize QXcbScreen's pixelDensity values + +When the monitor's EDID contains invalid values, we should catch that now +and fall back to 96dpi instead of returning unexpected values. +--- + src/plugins/platforms/xcb/qxcbscreen.cpp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp +index df458e85d7..7e898db17c 100644 +--- a/src/plugins/platforms/xcb/qxcbscreen.cpp ++++ b/src/plugins/platforms/xcb/qxcbscreen.cpp +@@ -751,6 +751,16 @@ void QXcbScreen::updateGeometry(const QRect &geometry, uint8_t rotation) + + qreal dpi = geometry.width() / physicalSize().width() * qreal(25.4); + m_pixelDensity = qMax(1, qRound(dpi/96)); ++ ++ if(m_pixelDensity > 1 && qEnvironmentVariableIsEmpty("QT_XCB_FORCE_ACCEPT_DPI")) { ++ // If we have no physical size or the resolution is untypical, fall back to 1x ++ if (physicalSize().height() <= 0 ++ || geometry.height() < 1440 ++ || m_pixelDensity > 3) { ++ m_pixelDensity = 1; ++ } ++ } ++ + m_geometry = geometry; + m_availableGeometry = geometry & m_virtualDesktop->workArea(); + QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); +-- +2.17.1 + diff --git a/0002-xcb-Use-the-screen-s-physical-DPI-as-logical-DPI-unl.patch b/0002-xcb-Use-the-screen-s-physical-DPI-as-logical-DPI-unl.patch new file mode 100644 index 0000000..7050278 --- /dev/null +++ b/0002-xcb-Use-the-screen-s-physical-DPI-as-logical-DPI-unl.patch @@ -0,0 +1,40 @@ +From 267ab09b87dd7e2ae7dd3e85a76398506e7f1ae9 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 25 Apr 2018 18:34:01 +0200 +Subject: [PATCH 2/2] xcb: Use the screen's physical DPI as logical DPI, unless + overwritten + +The size of the virtual screen is most of the time meaningless, as X fakes it +to result in 96 DPI, irregardless of the actual monitor DPI. + +This results in wrong font rendering on non-96 DPI monitors. + +Task-number: QTBUG-67928 +--- + src/plugins/platforms/xcb/qxcbscreen.cpp | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp +index 7e898db17c..21076a0812 100644 +--- a/src/plugins/platforms/xcb/qxcbscreen.cpp ++++ b/src/plugins/platforms/xcb/qxcbscreen.cpp +@@ -606,7 +606,15 @@ QDpi QXcbScreen::logicalDpi() const + if (forcedDpi > 0) { + return QDpi(forcedDpi, forcedDpi); + } +- return virtualDpi(); ++ ++ // By default, X fakes the virtual size to be 96 dpi (+-rounding), ++ // so if it's different the user overwrote it. ++ if (qRound(virtualDpi().first) != 96 || ++ qRound(virtualDpi().second) != 96) { ++ return virtualDpi(); ++ } ++ ++ return QDpi(m_pixelDensity * 96, m_pixelDensity * 96); + } + + qreal QXcbScreen::pixelDensity() const +-- +2.17.1 + diff --git a/libqt5-qtbase.changes b/libqt5-qtbase.changes index 47f7825..ba7f849 100644 --- a/libqt5-qtbase.changes +++ b/libqt5-qtbase.changes @@ -4,6 +4,13 @@ Fri Jun 29 07:21:37 UTC 2018 - fabian@ritter-vogt.de - Revert upstream commit to avoid regressions (kde#395988): * 0001-Revert-QWidgetWindow-Immediately-forward-close-event.patch +------------------------------------------------------------------- +Sat Jun 23 14:03:04 UTC 2018 - fabian@ritter-vogt.de + +- Add patches to improve OOTB experience with HiDPI: + * 0001-Sanitize-QXcbScreen-s-pixelDensity-values.patch + * 0002-xcb-Use-the-screen-s-physical-DPI-as-logical-DPI-unl.patch + ------------------------------------------------------------------- Tue Jun 19 10:49:46 CEST 2018 - fabian@ritter-vogt.de diff --git a/libqt5-qtbase.spec b/libqt5-qtbase.spec index b82a76a..81c2344 100644 --- a/libqt5-qtbase.spec +++ b/libqt5-qtbase.spec @@ -66,8 +66,10 @@ Patch12: 0001-Add-remote-print-queue-support.patch Patch13: 0001-Revert-QWidgetWindow-Immediately-forward-close-event.patch # PATCH-FIX-OPENSUSE Patch16: 0001-Hack-together-a-way-to-get-fallback-from-xcb-working.patch +Patch17: 0001-Sanitize-QXcbScreen-s-pixelDensity-values.patch +Patch18: 0002-xcb-Use-the-screen-s-physical-DPI-as-logical-DPI-unl.patch # PATCH-FIX-UPSTREAM -Patch17: qapplication-emit-palettechanged.patch +Patch19: qapplication-emit-palettechanged.patch # patches 1000- 2000 and above from upstream 5.11 branch # # patches 2000-3000 and above from upstream 5.12/dev branch # BuildRequires: alsa-devel