File 0001-Sanitize-QXcbScreen-s-pixelDensity-values.patch of Package libqt5-qtbase.23098

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 39e83e04..ab902e3a 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -755,6 +755,16 @@ void QXcbScreen::updateGeometry(const QRect &geometry, uint8_t rotation)
     qreal referenceDpi = physicalSize().width() <= 320 ? 128 : 96;
 
     m_pixelDensity = qMax(1, qRound(dpi/referenceDpi));
+
+    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);
openSUSE Build Service is sponsored by