config: make the blend space configurable
This commit is contained in:
parent
991b212120
commit
39c770f6e2
20 changed files with 257 additions and 15 deletions
|
|
@ -79,7 +79,7 @@ impl Global for JayCompositorGlobal {
|
|||
}
|
||||
|
||||
fn version(&self) -> u32 {
|
||||
20
|
||||
21
|
||||
}
|
||||
|
||||
fn required_caps(&self) -> ClientCaps {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use {
|
|||
client::{Client, ClientError},
|
||||
compositor::MAX_EXTENTS,
|
||||
format::named_formats,
|
||||
ifs::wl_output,
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
scale::Scale,
|
||||
|
|
@ -34,6 +35,7 @@ const FORMAT_SINCE: Version = Version(8);
|
|||
const FLIP_MARGIN_SINCE: Version = Version(10);
|
||||
const COLORIMETRY_SINCE: Version = Version(15);
|
||||
const BRIGHTNESS_SINCE: Version = Version(16);
|
||||
const BLEND_SPACE_SINCE: Version = Version(21);
|
||||
|
||||
impl JayRandr {
|
||||
pub fn new(id: JayRandrId, client: &Rc<Client>, version: Version) -> Self {
|
||||
|
|
@ -207,6 +209,12 @@ impl JayRandr {
|
|||
});
|
||||
}
|
||||
}
|
||||
if self.version >= BLEND_SPACE_SINCE {
|
||||
self.client.event(BlendSpace {
|
||||
self_id: self.id,
|
||||
blend_space: node.global.persistent.blend_space.get().name(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn send_error(&self, msg: &str) {
|
||||
|
|
@ -526,6 +534,23 @@ impl JayRandrRequestHandler for JayRandr {
|
|||
c.set_brightness(None);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_blend_space(&self, req: SetBlendSpace<'_>, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
let space = 'space: {
|
||||
for space in wl_output::BlendSpace::variants() {
|
||||
if space.name() == req.blend_space {
|
||||
break 'space space;
|
||||
}
|
||||
}
|
||||
self.send_error(&format!("Unknown blend space: {}", req.blend_space));
|
||||
return Ok(());
|
||||
};
|
||||
let Some(c) = self.get_output_node(req.output) else {
|
||||
return Ok(());
|
||||
};
|
||||
c.set_blend_space(space);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
object_base! {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ use {
|
|||
},
|
||||
ahash::AHashMap,
|
||||
jay_config::video::Transform,
|
||||
linearize::Linearize,
|
||||
std::{
|
||||
cell::{Cell, RefCell},
|
||||
collections::hash_map::Entry,
|
||||
|
|
@ -115,6 +116,21 @@ impl OutputGlobalOpt {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Linearize)]
|
||||
pub enum BlendSpace {
|
||||
Linear,
|
||||
Srgb,
|
||||
}
|
||||
|
||||
impl BlendSpace {
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
BlendSpace::Linear => "linear",
|
||||
BlendSpace::Srgb => "srgb",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PersistentOutputState {
|
||||
pub transform: Cell<Transform>,
|
||||
pub scale: Cell<crate::scale::Scale>,
|
||||
|
|
@ -123,6 +139,7 @@ pub struct PersistentOutputState {
|
|||
pub vrr_cursor_hz: Cell<Option<f64>>,
|
||||
pub tearing_mode: Cell<&'static TearingMode>,
|
||||
pub brightness: Cell<Option<f64>>,
|
||||
pub blend_space: Cell<BlendSpace>,
|
||||
}
|
||||
|
||||
impl Default for PersistentOutputState {
|
||||
|
|
@ -135,6 +152,7 @@ impl Default for PersistentOutputState {
|
|||
vrr_cursor_hz: Default::default(),
|
||||
tearing_mode: Cell::new(&TearingMode::Never),
|
||||
brightness: Default::default(),
|
||||
blend_space: Cell::new(BlendSpace::Srgb),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue