wayland: add jay_workspace
This commit is contained in:
parent
53ca7b5b2a
commit
83baa6aadb
10 changed files with 183 additions and 28 deletions
|
|
@ -237,6 +237,7 @@ impl OutputNode {
|
|||
fullscreen: Default::default(),
|
||||
visible_on_desired_output: Cell::new(false),
|
||||
desired_output: CloneCell::new(self.global.output_id.clone()),
|
||||
jay_workspaces: Default::default(),
|
||||
});
|
||||
self.state.workspaces.set(name, workspace.clone());
|
||||
workspace
|
||||
|
|
@ -254,10 +255,16 @@ impl OutputNode {
|
|||
return false;
|
||||
}
|
||||
collect_kb_foci2(old.clone(), &mut seats);
|
||||
old.set_visible(false);
|
||||
if old.is_empty() {
|
||||
for jw in old.jay_workspaces.lock().values() {
|
||||
jw.send_destroyed();
|
||||
jw.workspace.set(None);
|
||||
}
|
||||
old.clear();
|
||||
self.state.workspaces.remove(&old.name);
|
||||
} else {
|
||||
old.set_visible(false);
|
||||
old.flush_jay_workspaces();
|
||||
}
|
||||
}
|
||||
ws.set_visible(true);
|
||||
|
|
@ -286,6 +293,7 @@ impl OutputNode {
|
|||
fullscreen: Default::default(),
|
||||
visible_on_desired_output: Cell::new(false),
|
||||
desired_output: CloneCell::new(self.global.output_id.clone()),
|
||||
jay_workspaces: Default::default(),
|
||||
});
|
||||
ws.output_link
|
||||
.set(Some(self.workspaces.add_last(ws.clone())));
|
||||
|
|
@ -581,6 +589,7 @@ impl Node for OutputNode {
|
|||
return;
|
||||
};
|
||||
self.show_workspace(&ws);
|
||||
ws.flush_jay_workspaces();
|
||||
self.update_render_data();
|
||||
self.state.tree_changed();
|
||||
}
|
||||
|
|
@ -615,6 +624,7 @@ impl Node for OutputNode {
|
|||
if !self.show_workspace(&ws) {
|
||||
return;
|
||||
}
|
||||
ws.flush_jay_workspaces();
|
||||
ws.deref()
|
||||
.clone()
|
||||
.node_do_focus(seat, Direction::Unspecified);
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ impl ToplevelData {
|
|||
fd.workspace.fullscreen.take();
|
||||
if node.node_visible() {
|
||||
fd.workspace.set_visible(true);
|
||||
fd.workspace.flush_jay_workspaces();
|
||||
}
|
||||
if fd.placeholder.is_destroyed() {
|
||||
state.map_tiled(node);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
use {
|
||||
crate::{
|
||||
client::ClientId,
|
||||
cursor::KnownCursor,
|
||||
ifs::{
|
||||
jay_workspace::JayWorkspace,
|
||||
wl_output::OutputId,
|
||||
wl_seat::{NodeSeatState, WlSeatGlobal},
|
||||
wl_surface::WlSurface,
|
||||
|
|
@ -15,8 +17,10 @@ use {
|
|||
},
|
||||
utils::{
|
||||
clonecell::CloneCell,
|
||||
copyhashmap::CopyHashMap,
|
||||
linkedlist::{LinkedList, LinkedNode},
|
||||
},
|
||||
wire::JayWorkspaceId,
|
||||
},
|
||||
std::{cell::Cell, fmt::Debug, ops::Deref, rc::Rc},
|
||||
};
|
||||
|
|
@ -37,6 +41,7 @@ pub struct WorkspaceNode {
|
|||
pub fullscreen: CloneCell<Option<Rc<dyn ToplevelNode>>>,
|
||||
pub visible_on_desired_output: Cell<bool>,
|
||||
pub desired_output: CloneCell<Rc<OutputId>>,
|
||||
pub jay_workspaces: CopyHashMap<(ClientId, JayWorkspaceId), Rc<JayWorkspace>>,
|
||||
}
|
||||
|
||||
impl WorkspaceNode {
|
||||
|
|
@ -44,10 +49,14 @@ impl WorkspaceNode {
|
|||
self.container.set(None);
|
||||
self.output_link.set(None);
|
||||
self.fullscreen.set(None);
|
||||
self.jay_workspaces.clear();
|
||||
}
|
||||
|
||||
pub fn set_output(&self, output: &Rc<OutputNode>) {
|
||||
self.output.set(output.clone());
|
||||
for jw in self.jay_workspaces.lock().values() {
|
||||
jw.send_output(output);
|
||||
}
|
||||
struct OutputSetter<'a>(&'a Rc<OutputNode>);
|
||||
impl NodeVisitorBase for OutputSetter<'_> {
|
||||
fn visit_surface(&mut self, node: &Rc<WlSurface>) {
|
||||
|
|
@ -85,7 +94,16 @@ impl WorkspaceNode {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn flush_jay_workspaces(&self) {
|
||||
for jw in self.jay_workspaces.lock().values() {
|
||||
jw.send_done();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_visible(&self, visible: bool) {
|
||||
for jw in self.jay_workspaces.lock().values() {
|
||||
jw.send_visible(visible);
|
||||
}
|
||||
self.visible.set(visible);
|
||||
if let Some(fs) = self.fullscreen.get() {
|
||||
fs.tl_set_visible(visible);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue