1
0
Fork 0
forked from wry/wry

config: make the blend space configurable

This commit is contained in:
Julian Orth 2025-09-05 19:19:54 +02:00
parent 991b212120
commit 39c770f6e2
20 changed files with 257 additions and 15 deletions

View file

@ -28,8 +28,8 @@ use {
theme::{Color, colors::Colorable, sized::Resizable},
timer::Timer,
video::{
ColorSpace, Connector, DrmDevice, Eotf, Format, GfxApi, Mode, TearingMode, Transform,
VrrMode,
BlendSpace, ColorSpace, Connector, DrmDevice, Eotf, Format, GfxApi, Mode, TearingMode,
Transform, VrrMode,
connector_type::{CON_UNKNOWN, ConnectorType},
},
window::{
@ -1050,6 +1050,13 @@ impl ConfigClient {
});
}
pub fn connector_set_blend_space(&self, connector: Connector, blend_space: BlendSpace) {
self.send(&ClientMessage::ConnectorSetBlendSpace {
connector,
blend_space,
});
}
pub fn connector_set_brightness(&self, connector: Connector, brightness: Option<f64>) {
self.send(&ClientMessage::ConnectorSetBrightness {
connector,

View file

@ -12,8 +12,8 @@ use {
theme::{Color, colors::Colorable, sized::Resizable},
timer::Timer,
video::{
ColorSpace, Connector, DrmDevice, Eotf, Format, GfxApi, TearingMode, Transform,
VrrMode, connector_type::ConnectorType,
BlendSpace, ColorSpace, Connector, DrmDevice, Eotf, Format, GfxApi, TearingMode,
Transform, VrrMode, connector_type::ConnectorType,
},
window::{ContentType, TileState, Window, WindowMatcher, WindowType},
workspace::WorkspaceDisplayOrder,
@ -764,6 +764,10 @@ pub enum ClientMessage<'a> {
SetWorkspaceDisplayOrder {
order: WorkspaceDisplayOrder,
},
ConnectorSetBlendSpace {
connector: Connector,
blend_space: BlendSpace,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -286,6 +286,13 @@ impl Connector {
get!().connector_set_colors(self, color_space, eotf);
}
/// Sets the space in which blending is performed for this output.
///
/// The default is [`BlendSpace::SRGB`]
pub fn set_blend_space(self, blend_space: BlendSpace) {
get!().connector_set_blend_space(self, blend_space);
}
/// Sets the brightness of the output.
///
/// By default or when `brightness` is `None`, the brightness depends on the
@ -731,3 +738,16 @@ impl Eotf {
/// The PQ EOTF.
pub const PQ: Self = Self(1);
}
/// A space in which color blending is performed.
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub struct BlendSpace(pub u32);
impl BlendSpace {
/// The sRGB blend space with sRGB primaries and gamma22 transfer function. This is
/// the classic desktop blend space.
pub const SRGB: Self = Self(0);
/// The linear blend space performs blending in linear space, which is more physically
/// correct but leads to much lighter output when blending light and dark colors.
pub const LINEAR: Self = Self(1);
}