head-management: add non-desktop-info-v1 extension
This commit is contained in:
parent
81a7c973d0
commit
b76aade265
17 changed files with 164 additions and 5 deletions
|
|
@ -77,6 +77,8 @@ pub struct HeadState {
|
|||
pub transform: Transform,
|
||||
pub scale: Scale,
|
||||
pub monitor_info: Option<RcEq<MonitorInfo>>,
|
||||
pub inherent_non_desktop: bool,
|
||||
pub override_non_desktop: Option<bool>,
|
||||
}
|
||||
|
||||
impl HeadState {
|
||||
|
|
@ -92,6 +94,9 @@ impl HeadState {
|
|||
if mi.non_desktop {
|
||||
return;
|
||||
}
|
||||
if self.override_non_desktop == Some(true) {
|
||||
return;
|
||||
}
|
||||
self.in_compositor_space = true;
|
||||
self.wl_output = wl_output;
|
||||
}
|
||||
|
|
@ -206,6 +211,7 @@ impl HeadManagers {
|
|||
let state = &mut *self.state.borrow_mut();
|
||||
state.connected = true;
|
||||
state.monitor_info = Some(RcEq(output.monitor_info.clone()));
|
||||
state.inherent_non_desktop = output.monitor_info.non_desktop;
|
||||
state.update_in_compositor_space(output.node.as_ref().map(|n| n.global.name));
|
||||
if let Some(n) = &output.node {
|
||||
state.position = n.global.pos.get().position();
|
||||
|
|
@ -239,6 +245,10 @@ impl HeadManagers {
|
|||
ext.send_wl_output(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
if let Some(ext) = &head.ext.non_desktop_info_v1 {
|
||||
ext.send_state(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -337,4 +347,16 @@ impl HeadManagers {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_non_desktop_override_changed(&self, overrd: Option<bool>) {
|
||||
let state = &mut *self.state.borrow_mut();
|
||||
state.override_non_desktop = overrd;
|
||||
for head in self.managers.lock().values() {
|
||||
skip_in_transaction!(head);
|
||||
if let Some(ext) = &head.ext.non_desktop_info_v1 {
|
||||
ext.send_state(state);
|
||||
head.session.schedule_done();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue