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

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(+)

Index: qtbase-opensource-src-5.9.6/src/plugins/platforms/xcb/qxcbscreen.cpp
===================================================================
--- qtbase-opensource-src-5.9.6.orig/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ qtbase-opensource-src-5.9.6/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -621,6 +621,16 @@ void QXcbScreen::updateGeometry(const QR
 
     qreal dpi = xGeometry.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
+            || xGeometry.height() < 1440
+            || m_pixelDensity > 3) {
+            m_pixelDensity = 1;
+        }
+    }
+
     m_geometry = QRect(xGeometry.topLeft(), xGeometry.size());
     m_availableGeometry = xGeometry & m_virtualDesktop->workArea();
     QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry);
openSUSE Build Service is sponsored by