head-management: add ReadOnlyHeadState
This commit is contained in:
parent
cf8b696f03
commit
cbe190274e
1 changed files with 19 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ use {
|
|||
wire::JayHeadManagerSessionV1Id,
|
||||
},
|
||||
std::{
|
||||
cell::{Cell, RefCell},
|
||||
cell::{Cell, Ref, RefCell},
|
||||
rc::Rc,
|
||||
},
|
||||
thiserror::Error,
|
||||
|
|
@ -94,6 +94,17 @@ pub struct HeadState {
|
|||
pub brightness: Option<f64>,
|
||||
}
|
||||
|
||||
pub struct ReadOnlyHeadState {
|
||||
state: Rc<RefCell<HeadState>>,
|
||||
}
|
||||
|
||||
impl ReadOnlyHeadState {
|
||||
#[expect(dead_code)]
|
||||
pub fn borrow(&self) -> Ref<'_, HeadState> {
|
||||
self.state.borrow()
|
||||
}
|
||||
}
|
||||
|
||||
impl HeadState {
|
||||
fn update_in_compositor_space(&mut self, wl_output: Option<GlobalName>) {
|
||||
self.in_compositor_space = false;
|
||||
|
|
@ -218,6 +229,13 @@ impl HeadManagers {
|
|||
}
|
||||
}
|
||||
|
||||
#[expect(dead_code)]
|
||||
pub fn state(&self) -> ReadOnlyHeadState {
|
||||
ReadOnlyHeadState {
|
||||
state: self.state.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_removed(&self) {
|
||||
for head in self.managers.lock().drain_values() {
|
||||
skip_in_transaction!(head);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue