1
0
Fork 0
forked from wry/wry

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:
mahkoh 2026-01-17 11:35:29 +01:00 committed by GitHub
commit 2c03dbbaa4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 23 deletions

View file

@ -29,9 +29,8 @@ use {
theme::{Color, ThemeSized}, theme::{Color, ThemeSized},
tree::{ tree::{
ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase, OutputNode, ContainerNode, ContainerSplit, FloatNode, Node, NodeVisitorBase, OutputNode,
TearingMode, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode, WsMoveConfig, TearingMode, ToplevelData, ToplevelNode, VrrMode, WorkspaceNode, toplevel_create_split,
move_ws_to_output, toplevel_create_split, toplevel_parent_container, toplevel_parent_container, toplevel_set_floating, toplevel_set_workspace,
toplevel_set_floating, toplevel_set_workspace,
}, },
utils::{ utils::{
asyncevent::AsyncEvent, asyncevent::AsyncEvent,
@ -1118,25 +1117,7 @@ impl ConfigProxyHandler {
_ => return Ok(()), _ => return Ok(()),
}, },
}; };
if ws.is_dummy || output.is_dummy { self.state.move_ws_to_output(&ws, &output);
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();
Ok(()) Ok(())
} }

View file

@ -97,7 +97,7 @@ use {
ContainerNode, ContainerSplit, Direction, DisplayNode, FindTreeUsecase, FloatNode, ContainerNode, ContainerSplit, Direction, DisplayNode, FindTreeUsecase, FloatNode,
FoundNode, LatchListener, Node, NodeIds, NodeVisitorBase, OutputNode, PlaceholderNode, FoundNode, LatchListener, Node, NodeIds, NodeVisitorBase, OutputNode, PlaceholderNode,
TearingMode, ToplevelData, ToplevelNode, ToplevelNodeBase, VrrMode, WorkspaceNode, TearingMode, ToplevelData, ToplevelNode, ToplevelNodeBase, VrrMode, WorkspaceNode,
generic_node_visitor, WsMoveConfig, generic_node_visitor, move_ws_to_output,
}, },
udmabuf::UdmabufHolder, udmabuf::UdmabufHolder,
utils::{ utils::{
@ -1640,6 +1640,28 @@ impl State {
found_tree.clear(); found_tree.clear();
node 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)] #[derive(Debug, Error)]