diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2025-12-28 16:44:04 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-28 14:44:04 +0100 |
| commit | 6a055fc747a5a899b97f9b4c1d1a52229a805b1e (patch) | |
| tree | 696ed8c402ef60f52612e001db0ddb1b7a762c71 /src | |
| parent | a8452705d6512da36f66e4a7d6e7799afbc7ffdd (diff) | |
cm: allow force disabling WCG and HDR per monitor (#12733)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helpers/Monitor.cpp | 15 | ||||
| -rw-r--r-- | src/helpers/Monitor.hpp | 12 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index af8ed0c7..5069f5d8 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -1973,11 +1973,22 @@ void CMonitor::onCursorMovedOnMonitor() { } bool CMonitor::supportsWideColor() { - return m_supportsWideColor || m_output->parsedEDID.supportsBT2020; + switch (m_supportsWideColor) { + case -1: return false; + case 1: return true; + default: return m_output->parsedEDID.supportsBT2020; + } } bool CMonitor::supportsHDR() { - return supportsWideColor() && (m_supportsHDR || (m_output->parsedEDID.hdrMetadata.has_value() ? m_output->parsedEDID.hdrMetadata->supportsPQ : false)); + if (!supportsWideColor()) + return false; + + switch (m_supportsHDR) { + case -1: return false; + case 1: return true; + default: return m_output->parsedEDID.hdrMetadata.has_value() ? m_output->parsedEDID.hdrMetadata->supportsPQ : false; + } } float CMonitor::minLuminance(float defaultValue) { diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 4c27d1b3..98d672e6 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -55,10 +55,10 @@ struct SMonitorRule { float sdrBrightness = 1.0f; // SDR -> HDR Desktop::CReservedArea reservedArea; - bool supportsWideColor = false; // false does nothing, true overrides EDID - bool supportsHDR = false; // false does nothing, true overrides EDID - float sdrMinLuminance = 0.2f; // SDR -> HDR - int sdrMaxLuminance = 80; // SDR -> HDR + int supportsWideColor = 0; // 0 - auto, 1 - force enable, -1 - force disable + int supportsHDR = 0; // 0 - auto, 1 - force enable, -1 - force disable + float sdrMinLuminance = 0.2f; // SDR -> HDR + int sdrMaxLuminance = 80; // SDR -> HDR // Incorrect values will result in reduced luminance range or incorrect tonemapping. Shouldn't damage the HW. Use with care in case of a faulty monitor firmware. float minLuminance = -1.0f; // >= 0 overrides EDID @@ -368,8 +368,8 @@ class CMonitor { CHyprSignalListener commit; } m_listeners; - bool m_supportsWideColor = false; - bool m_supportsHDR = false; + int m_supportsWideColor = 0; + int m_supportsHDR = 0; float m_minLuminance = -1.0f; int m_maxLuminance = -1; int m_maxAvgLuminance = -1; |
