forked from pool/libqt5-qtbase
43852afb3d
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
36 lines
1.4 KiB
Diff
36 lines
1.4 KiB
Diff
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
|
|
|