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

@ -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! {