From e15014e031589e1df2dc29a5ce94325676796ac4 Mon Sep 17 00:00:00 2001 From: UjinT34 <41110182+UjinT34@users.noreply.github.com> Date: Tue, 15 Jul 2025 20:33:14 +0300 Subject: protocols/cm: Fix preferred image description (#11026) --- src/helpers/Monitor.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/helpers/Monitor.cpp') diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 3b440e56..4e5c4080 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -412,6 +412,7 @@ void CMonitor::onDisconnect(bool destroy) { } void CMonitor::applyCMType(eCMType cmType) { + auto oldImageDescription = m_imageDescription; switch (cmType) { case CM_SRGB: m_imageDescription = {}; break; // assumes SImageDescirption defaults to sRGB case CM_WIDE: @@ -461,6 +462,11 @@ void CMonitor::applyCMType(eCMType cmType) { m_imageDescription.luminances.max = m_maxLuminance; if (m_maxAvgLuminance >= 0) m_imageDescription.luminances.reference = m_maxAvgLuminance; + + if (oldImageDescription != m_imageDescription) { + m_imageDescription.updateId(); + PROTO::colorManagement->onMonitorImageDescriptionChanged(m_self); + } } bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { @@ -783,8 +789,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { m_supportsWideColor = RULE->supportsHDR; m_supportsHDR = RULE->supportsHDR; - auto oldImageDescription = m_imageDescription; - m_cmType = RULE->cmType; + m_cmType = RULE->cmType; switch (m_cmType) { case CM_AUTO: m_cmType = m_enabled10bit && supportsWideColor() ? CM_WIDE : CM_SRGB; break; case CM_EDID: m_cmType = m_output->parsedEDID.chromaticityCoords.has_value() ? CM_EDID : CM_SRGB; break; @@ -801,8 +806,6 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { m_maxAvgLuminance = RULE->maxAvgLuminance; applyCMType(m_cmType); - if (oldImageDescription != m_imageDescription) - PROTO::colorManagement->onMonitorImageDescriptionChanged(m_self); m_sdrSaturation = RULE->sdrSaturation; m_sdrBrightness = RULE->sdrBrightness; -- cgit v1.2.3