1
0
Fork 0
forked from wry/wry

tree: implement workspace dragging

This commit is contained in:
Julian Orth 2024-10-01 10:29:10 +02:00
parent 132986df2a
commit 1dd20fb87b
8 changed files with 235 additions and 7 deletions

View file

@ -379,8 +379,10 @@ impl ContainingNode for WorkspaceNode {
}
pub struct WsMoveConfig {
pub make_visible_always: bool,
pub make_visible_if_empty: bool,
pub source_is_destroyed: bool,
pub before: Option<Rc<WorkspaceNode>>,
}
pub fn move_ws_to_output(
@ -390,8 +392,19 @@ pub fn move_ws_to_output(
) {
let source = ws.output.get();
ws.set_output(&target);
target.workspaces.add_last_existing(&ws);
if config.make_visible_if_empty && target.workspace.is_none() && !target.is_dummy {
'link: {
if let Some(before) = config.before {
if let Some(link) = &*before.output_link.borrow() {
link.prepend_existing(ws);
break 'link;
}
}
target.workspaces.add_last_existing(&ws);
}
let make_visible = !target.is_dummy
&& (config.make_visible_always
|| (config.make_visible_if_empty && target.workspace.is_none()));
if make_visible {
target.show_workspace(&ws);
} else {
ws.set_visible(false);
@ -423,3 +436,9 @@ pub fn move_ws_to_output(
target.state.damage(target.global.pos.get());
}
}
pub struct WorkspaceDragDestination {
pub highlight: Rect,
pub output: Rc<OutputNode>,
pub before: Option<Rc<WorkspaceNode>>,
}