1
0
Fork 0
forked from wry/wry

tree: restore workspaces after monitor reconnect

This commit is contained in:
Julian Orth 2022-05-20 12:55:45 +02:00
parent eaa3b85a97
commit 7476e6f2d9
6 changed files with 80 additions and 9 deletions

View file

@ -168,6 +168,7 @@ impl OutputNode {
};
let workspace = Rc::new(WorkspaceNode {
id: self.state.node_ids.next(),
is_dummy: false,
output: CloneCell::new(self.clone()),
position: Default::default(),
container: Default::default(),
@ -177,6 +178,8 @@ impl OutputNode {
output_link: Default::default(),
visible: Cell::new(true),
fullscreen: Default::default(),
visible_on_desired_output: Cell::new(false),
desired_output: CloneCell::new(self.global.output_id.clone()),
});
self.state.workspaces.set(name, workspace.clone());
workspace
@ -214,6 +217,7 @@ impl OutputNode {
pub fn create_workspace(self: &Rc<Self>, name: &str) -> Rc<WorkspaceNode> {
let ws = Rc::new(WorkspaceNode {
id: self.state.node_ids.next(),
is_dummy: false,
output: CloneCell::new(self.clone()),
position: Cell::new(Default::default()),
container: Default::default(),
@ -223,6 +227,8 @@ impl OutputNode {
output_link: Cell::new(None),
visible: Cell::new(false),
fullscreen: Default::default(),
visible_on_desired_output: Cell::new(false),
desired_output: CloneCell::new(self.global.output_id.clone()),
});
ws.output_link
.set(Some(self.workspaces.add_last(ws.clone())));

View file

@ -1,7 +1,10 @@
use {
crate::{
cursor::KnownCursor,
ifs::wl_seat::{NodeSeatState, WlSeatGlobal},
ifs::{
wl_output::OutputId,
wl_seat::{NodeSeatState, WlSeatGlobal},
},
rect::Rect,
render::Renderer,
tree::{
@ -20,6 +23,7 @@ tree_id!(WorkspaceNodeId);
pub struct WorkspaceNode {
pub id: WorkspaceNodeId,
pub is_dummy: bool,
pub output: CloneCell<Rc<OutputNode>>,
pub position: Cell<Rect>,
pub container: CloneCell<Option<Rc<ContainerNode>>>,
@ -29,6 +33,8 @@ pub struct WorkspaceNode {
pub output_link: Cell<Option<LinkedNode<Rc<WorkspaceNode>>>>,
pub visible: Cell<bool>,
pub fullscreen: CloneCell<Option<Rc<dyn ToplevelNode>>>,
pub visible_on_desired_output: Cell<bool>,
pub desired_output: CloneCell<Rc<OutputId>>,
}
impl WorkspaceNode {