Dominique Leuenberger 2018-07-04 21:54:39 +00:00 committed by Git OBS Bridge
parent 6dfaa29f79
commit 43852afb3d
4 changed files with 85 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 75bb439f45608b21781d18170a88aaa2aedefb04 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
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

View File

@ -0,0 +1,40 @@
From 267ab09b87dd7e2ae7dd3e85a76398506e7f1ae9 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
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

View File

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

View File

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