summaryrefslogtreecommitdiff
path: root/src/helpers/Monitor.cpp
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2025-07-15 20:33:14 +0300
committerGitHub <noreply@github.com>2025-07-15 19:33:14 +0200
commite15014e031589e1df2dc29a5ce94325676796ac4 (patch)
tree5d56992b9e6c458dd1830c4b9ea235c0391fedd8 /src/helpers/Monitor.cpp
parentbc764f7065c8e46b4e62cbb511b419034712c509 (diff)
protocols/cm: Fix preferred image description (#11026)
Diffstat (limited to 'src/helpers/Monitor.cpp')
-rw-r--r--src/helpers/Monitor.cpp11
1 files changed, 7 insertions, 4 deletions
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;