head-management: add brightness-info-v1 extension
This commit is contained in:
parent
1a306c4fa9
commit
e0f1dd549d
10 changed files with 136 additions and 3 deletions
|
|
@ -67,7 +67,7 @@ struct HeadCommon {
|
|||
pending: RefCell<Vec<HeadOp>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub struct HeadState {
|
||||
pub name: RcEq<String>,
|
||||
pub wl_output: Option<GlobalName>,
|
||||
|
|
@ -92,6 +92,7 @@ pub struct HeadState {
|
|||
pub color_space: BackendColorSpace,
|
||||
pub transfer_function: BackendTransferFunction,
|
||||
pub supported_formats: RcEq<Vec<&'static Format>>,
|
||||
pub brightness: Option<f64>,
|
||||
}
|
||||
|
||||
impl HeadState {
|
||||
|
|
@ -286,6 +287,11 @@ impl HeadManagers {
|
|||
ext.send_supported(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
if let Some(ext) = &head.ext.brightness_info_v1 {
|
||||
ext.send_implied_default_brightness(state);
|
||||
ext.send_brightness(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -491,6 +497,10 @@ impl HeadManagers {
|
|||
ext.send_state(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
if let Some(ext) = &head.ext.brightness_info_v1 {
|
||||
ext.send_implied_default_brightness(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -505,4 +515,16 @@ impl HeadManagers {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_brightness_change(&self, brightness: Option<f64>) {
|
||||
let state = &mut *self.state.borrow_mut();
|
||||
state.brightness = brightness;
|
||||
for head in self.managers.lock().values() {
|
||||
skip_in_transaction!(head);
|
||||
if let Some(ext) = &head.ext.brightness_info_v1 {
|
||||
ext.send_brightness(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue