1
0
Fork 0
forked from wry/wry

head-management: add format-setter-v1 extension

This commit is contained in:
Julian Orth 2025-07-14 15:46:57 +02:00
parent e0120ed3bb
commit 15e68fc551
10 changed files with 131 additions and 0 deletions

View file

@ -91,6 +91,7 @@ pub struct HeadState {
pub format: &'static Format,
pub color_space: BackendColorSpace,
pub transfer_function: BackendTransferFunction,
pub supported_formats: RcEq<Vec<&'static Format>>,
}
impl HeadState {
@ -129,6 +130,7 @@ enum HeadOp {
SetNonDesktopOverride(Option<bool>),
SetVrrMode(VrrMode),
SetTearingMode(TearingMode),
SetFormat(&'static Format),
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
@ -481,4 +483,16 @@ impl HeadManagers {
}
}
}
pub fn handle_formats_change(&self, formats: &Rc<Vec<&'static Format>>) {
let state = &mut *self.state.borrow_mut();
state.supported_formats.0 = formats.clone();
for head in self.managers.lock().values() {
skip_in_transaction!(head);
if let Some(ext) = &head.ext.format_setter_v1 {
ext.send_supported_formats(state);
head.session.schedule_done();
}
}
}
}