Merge pull request #717 from mahkoh/jorth/move_ws_to_output
config: move move_to_output logic to separate function
This commit is contained in:
commit
2c03dbbaa4
2 changed files with 26 additions and 23 deletions
|
|
@ -29,9 +29,8 @@ use {
|
|||
theme::{Color, ThemeSized},
|
||||
tree::{
|
||||
ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase, OutputNode,
|
||||
TearingMode, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode, WsMoveConfig,
|
||||
move_ws_to_output, toplevel_create_split, toplevel_parent_container,
|
||||
toplevel_set_floating, toplevel_set_workspace,
|
||||
TearingMode, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode, toplevel_create_split,
|
||||
toplevel_parent_container, toplevel_set_floating, toplevel_set_workspace,
|
||||
},
|
||||
utils::{
|
||||
asyncevent::AsyncEvent,
|
||||
|
|
@ -1118,25 +1117,7 @@ impl ConfigProxyHandler {
|
|||
_ => return Ok(()),
|
||||
},
|
||||
};
|
||||
if ws.is_dummy || output.is_dummy {
|
||||
return Ok(());
|
||||
}
|
||||
if ws.output.get().id == output.id {
|
||||
return Ok(());
|
||||
}
|
||||
let link = match &*ws.output_link.borrow() {
|
||||
None => return Ok(()),
|
||||
Some(l) => l.to_ref(),
|
||||
};
|
||||
let config = WsMoveConfig {
|
||||
make_visible_always: false,
|
||||
make_visible_if_empty: true,
|
||||
source_is_destroyed: false,
|
||||
before: None,
|
||||
};
|
||||
move_ws_to_output(&link, &output, config);
|
||||
ws.desired_output.set(output.global.output_id.clone());
|
||||
self.state.tree_changed();
|
||||
self.state.move_ws_to_output(&ws, &output);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
24
src/state.rs
24
src/state.rs
|
|
@ -97,7 +97,7 @@ use {
|
|||
ContainerNode, ContainerSplit, Direction, DisplayNode, FindTreeUsecase, FloatNode,
|
||||
FoundNode, LatchListener, Node, NodeIds, NodeVisitorBase, OutputNode, PlaceholderNode,
|
||||
TearingMode, ToplevelData, ToplevelNode, ToplevelNodeBase, VrrMode, WorkspaceNode,
|
||||
generic_node_visitor,
|
||||
WsMoveConfig, generic_node_visitor, move_ws_to_output,
|
||||
},
|
||||
udmabuf::UdmabufHolder,
|
||||
utils::{
|
||||
|
|
@ -1640,6 +1640,28 @@ impl State {
|
|||
found_tree.clear();
|
||||
node
|
||||
}
|
||||
|
||||
pub fn move_ws_to_output(&self, ws: &WorkspaceNode, output: &Rc<OutputNode>) {
|
||||
if ws.is_dummy || output.is_dummy {
|
||||
return;
|
||||
}
|
||||
if ws.output.get().id == output.id {
|
||||
return;
|
||||
}
|
||||
let link = match &*ws.output_link.borrow() {
|
||||
None => return,
|
||||
Some(l) => l.to_ref(),
|
||||
};
|
||||
let config = WsMoveConfig {
|
||||
make_visible_always: false,
|
||||
make_visible_if_empty: true,
|
||||
source_is_destroyed: false,
|
||||
before: None,
|
||||
};
|
||||
move_ws_to_output(&link, &output, config);
|
||||
ws.desired_output.set(output.global.output_id.clone());
|
||||
self.tree_changed();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue