From 6581bc62a3d0bd89d4ca3cc84a19652bb018b24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 19 May 2015 08:27:38 +0200 Subject: [PATCH] [drm] Fix KConfigGroup resolution for edid overwrite If one of the edid group identifiers cannot be used as it's empty, replace it by "unknown". REVIEW: 123848 --- backends/drm/drm_backend.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backends/drm/drm_backend.cpp b/backends/drm/drm_backend.cpp index 1a5ea21578..c003c9b892 100644 --- a/backends/drm/drm_backend.cpp +++ b/backends/drm/drm_backend.cpp @@ -631,7 +631,10 @@ void DrmOutput::init(drmModeConnector *connector) // the size might be completely borked. E.g. Samsung SyncMaster 2494HS reports 160x90 while in truth it's 520x292 // as this information is used to calculate DPI info, it's going to result in everything being huge KSharedConfig::Ptr config = KSharedConfig::openConfig(KWIN_CONFIG); - KConfigGroup group = config->group("EdidOverwrite").group(m_edid.eisaId).group(m_edid.monitorName).group(m_edid.serialNumber); + const QByteArray unknown = QByteArrayLiteral("unkown"); + KConfigGroup group = config->group("EdidOverwrite").group(m_edid.eisaId.isEmpty() ? unknown : m_edid.eisaId) + .group(m_edid.monitorName.isEmpty() ? unknown : m_edid.monitorName) + .group(m_edid.serialNumber.isEmpty() ? unknown : m_edid.serialNumber); if (group.hasKey("PhysicalSize")) { const QSize overwriteSize = group.readEntry("PhysicalSize", physicalSize); qCWarning(KWIN_DRM) << "Overwriting monitor physical size for" << m_edid.eisaId << "/" << m_edid.monitorName << "/" << m_edid.serialNumber << " from " << physicalSize << "to " << overwriteSize;