Merge pull request #711 from mahkoh/jorth/workspace-constructor
workspace: add constructor
This commit is contained in:
commit
bc9f2aef69
3 changed files with 33 additions and 50 deletions
|
|
@ -758,31 +758,8 @@ fn create_dummy_output(state: &Rc<State>) {
|
||||||
pinned: Default::default(),
|
pinned: Default::default(),
|
||||||
tearing: Default::default(),
|
tearing: Default::default(),
|
||||||
});
|
});
|
||||||
let dummy_workspace = Rc::new(WorkspaceNode {
|
let dummy_workspace = WorkspaceNode::new(&dummy_output, "dummy", true);
|
||||||
id: state.node_ids.next(),
|
dummy_workspace.may_capture.set(false);
|
||||||
state: state.clone(),
|
|
||||||
is_dummy: true,
|
|
||||||
output: CloneCell::new(dummy_output.clone()),
|
|
||||||
output_id: Cell::new(dummy_output.id),
|
|
||||||
position: Default::default(),
|
|
||||||
container: Default::default(),
|
|
||||||
stacked: Default::default(),
|
|
||||||
seat_state: Default::default(),
|
|
||||||
name: "dummy".to_string(),
|
|
||||||
output_link: Default::default(),
|
|
||||||
visible: Default::default(),
|
|
||||||
fullscreen: Default::default(),
|
|
||||||
visible_on_desired_output: Default::default(),
|
|
||||||
desired_output: CloneCell::new(dummy_output.global.output_id.clone()),
|
|
||||||
jay_workspaces: Default::default(),
|
|
||||||
may_capture: Cell::new(false),
|
|
||||||
has_capture: Cell::new(false),
|
|
||||||
title_texture: Default::default(),
|
|
||||||
attention_requests: Default::default(),
|
|
||||||
render_highlight: Default::default(),
|
|
||||||
ext_workspaces: Default::default(),
|
|
||||||
opt: Default::default(),
|
|
||||||
});
|
|
||||||
*dummy_workspace.output_link.borrow_mut() =
|
*dummy_workspace.output_link.borrow_mut() =
|
||||||
Some(dummy_output.workspaces.add_last(dummy_workspace.clone()));
|
Some(dummy_output.workspaces.add_last(dummy_workspace.clone()));
|
||||||
dummy_output.show_workspace(&dummy_workspace);
|
dummy_output.show_workspace(&dummy_workspace);
|
||||||
|
|
|
||||||
|
|
@ -730,31 +730,7 @@ impl OutputNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_workspace(self: &Rc<Self>, name: &str) -> Rc<WorkspaceNode> {
|
pub fn create_workspace(self: &Rc<Self>, name: &str) -> Rc<WorkspaceNode> {
|
||||||
let ws = Rc::new(WorkspaceNode {
|
let ws = WorkspaceNode::new(self, name, false);
|
||||||
id: self.state.node_ids.next(),
|
|
||||||
state: self.state.clone(),
|
|
||||||
is_dummy: false,
|
|
||||||
output: CloneCell::new(self.clone()),
|
|
||||||
output_id: Cell::new(self.id),
|
|
||||||
position: Cell::new(Default::default()),
|
|
||||||
container: Default::default(),
|
|
||||||
stacked: Default::default(),
|
|
||||||
seat_state: Default::default(),
|
|
||||||
name: name.to_string(),
|
|
||||||
output_link: Default::default(),
|
|
||||||
visible: Cell::new(false),
|
|
||||||
fullscreen: Default::default(),
|
|
||||||
visible_on_desired_output: Cell::new(false),
|
|
||||||
desired_output: CloneCell::new(self.global.output_id.clone()),
|
|
||||||
jay_workspaces: Default::default(),
|
|
||||||
may_capture: self.state.default_workspace_capture.clone(),
|
|
||||||
has_capture: Cell::new(false),
|
|
||||||
title_texture: Default::default(),
|
|
||||||
attention_requests: Default::default(),
|
|
||||||
render_highlight: Default::default(),
|
|
||||||
ext_workspaces: Default::default(),
|
|
||||||
opt: Default::default(),
|
|
||||||
});
|
|
||||||
ws.opt.set(Some(ws.clone()));
|
ws.opt.set(Some(ws.clone()));
|
||||||
ws.update_has_captures();
|
ws.update_has_captures();
|
||||||
let link = if let Some(before) = self.find_workspace_insertion_point(name) {
|
let link = if let Some(before) = self.find_workspace_insertion_point(name) {
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,36 @@ pub struct WorkspaceNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WorkspaceNode {
|
impl WorkspaceNode {
|
||||||
|
pub fn new(output: &Rc<OutputNode>, name: &str, is_dummy: bool) -> Rc<Self> {
|
||||||
|
let slf = Rc::new(Self {
|
||||||
|
id: output.state.node_ids.next(),
|
||||||
|
state: output.state.clone(),
|
||||||
|
is_dummy,
|
||||||
|
output: CloneCell::new(output.clone()),
|
||||||
|
output_id: Cell::new(output.id),
|
||||||
|
position: Default::default(),
|
||||||
|
container: Default::default(),
|
||||||
|
stacked: Default::default(),
|
||||||
|
seat_state: Default::default(),
|
||||||
|
name: name.to_string(),
|
||||||
|
output_link: Default::default(),
|
||||||
|
visible: Default::default(),
|
||||||
|
fullscreen: Default::default(),
|
||||||
|
visible_on_desired_output: Default::default(),
|
||||||
|
desired_output: CloneCell::new(output.global.output_id.clone()),
|
||||||
|
jay_workspaces: Default::default(),
|
||||||
|
may_capture: output.state.default_workspace_capture.clone(),
|
||||||
|
has_capture: Default::default(),
|
||||||
|
title_texture: Default::default(),
|
||||||
|
attention_requests: Default::default(),
|
||||||
|
render_highlight: Default::default(),
|
||||||
|
ext_workspaces: Default::default(),
|
||||||
|
opt: Default::default(),
|
||||||
|
});
|
||||||
|
slf.seat_state.disable_focus_history();
|
||||||
|
slf
|
||||||
|
}
|
||||||
|
|
||||||
pub fn clear(&self) {
|
pub fn clear(&self) {
|
||||||
self.container.set(None);
|
self.container.set(None);
|
||||||
*self.output_link.borrow_mut() = None;
|
*self.output_link.borrow_mut() = None;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue