From 154438f7dc078f7e3ad3a8901db72c472ab4fb11 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sun, 29 Mar 2026 15:46:59 +0200 Subject: [PATCH] cmm: add support for relative intent --- src/cmm/cmm_render_intent.rs | 8 +++++++- src/ifs/color_management/wp_color_manager_v1.rs | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cmm/cmm_render_intent.rs b/src/cmm/cmm_render_intent.rs index fd5cbc35..e9c6d7fe 100644 --- a/src/cmm/cmm_render_intent.rs +++ b/src/cmm/cmm_render_intent.rs @@ -1,5 +1,7 @@ use crate::{ - ifs::color_management::{RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE_BPC}, + ifs::color_management::{ + RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC, + }, object::Version, }; @@ -7,6 +9,7 @@ use crate::{ pub enum RenderIntent { #[default] Perceptual, + Relative, RelativeBpc, } @@ -14,6 +17,7 @@ impl RenderIntent { pub fn from_wayland(intent: u32, _version: Version) -> Option { let res = match intent { RENDER_INTENT_PERCEPTUAL => Self::Perceptual, + RENDER_INTENT_RELATIVE => Self::Relative, RENDER_INTENT_RELATIVE_BPC => Self::RelativeBpc, _ => return None, }; @@ -24,6 +28,7 @@ impl RenderIntent { match self { RenderIntent::Perceptual => true, RenderIntent::RelativeBpc => true, + RenderIntent::Relative => false, } } @@ -31,6 +36,7 @@ impl RenderIntent { match self { RenderIntent::Perceptual => true, RenderIntent::RelativeBpc => true, + RenderIntent::Relative => true, } } } diff --git a/src/ifs/color_management/wp_color_manager_v1.rs b/src/ifs/color_management/wp_color_manager_v1.rs index 44c4480e..b644ed68 100644 --- a/src/ifs/color_management/wp_color_manager_v1.rs +++ b/src/ifs/color_management/wp_color_manager_v1.rs @@ -6,7 +6,7 @@ use { color_management::{ COMPOUND_POWER_2_4_SINCE, FEATURE_EXTENDED_TARGET_VOLUME, FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, FEATURE_SET_TF_POWER, - RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE, + RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE, TRANSFER_FUNCTION_COMPOUND_POWER_2_4, consts::{ FEATURE_PARAMETRIC, FEATURE_SET_LUMINANCES, FEATURE_SET_PRIMARIES, @@ -78,6 +78,7 @@ pub struct WpColorManagerV1 { impl WpColorManagerV1 { fn send_capabilities(&self) { self.send_supported_intent(RENDER_INTENT_PERCEPTUAL); + self.send_supported_intent(RENDER_INTENT_RELATIVE); self.send_supported_intent(RENDER_INTENT_RELATIVE_BPC); self.send_supported_feature(FEATURE_PARAMETRIC); self.send_supported_feature(FEATURE_SET_PRIMARIES);