1
0
Fork 0
forked from wry/wry

tree: implement tile dragging

This commit is contained in:
Julian Orth 2024-09-30 18:31:19 +02:00
parent 83fd9f211e
commit 132986df2a
17 changed files with 925 additions and 52 deletions

View file

@ -15,7 +15,7 @@ use {
text::TextTexture,
tree::{
walker::NodeVisitor, ContainingNode, Direction, FindTreeResult, FindTreeUsecase,
FoundNode, Node, NodeId, StackedNode, ToplevelNode, WorkspaceNode,
FoundNode, Node, NodeId, StackedNode, TileDragDestination, ToplevelNode, WorkspaceNode,
},
utils::{
asyncevent::AsyncEvent, clonecell::CloneCell, double_click_state::DoubleClickState,
@ -528,6 +528,26 @@ impl FloatNode {
self.set_workspace(&ws);
}
}
pub fn tile_drag_destination(
self: &Rc<Self>,
source: NodeId,
abs_x: i32,
abs_y: i32,
) -> Option<TileDragDestination> {
let child = self.child.get()?;
let theme = &self.state.theme.sizes;
let bw = theme.border_width.get();
let th = theme.title_height.get();
let pos = self.position.get();
let body = Rect::new(
pos.x1() + bw,
pos.y1() + bw + th + 1,
pos.x2() - bw,
pos.y2() - bw,
)?;
child.tl_tile_drag_destination(source, None, body, abs_x, abs_y)
}
}
impl Debug for FloatNode {