1
0
Fork 0
forked from wry/wry

seat: add framework to select toplevels

This commit is contained in:
Julian Orth 2024-04-18 13:43:44 +02:00
parent e4e090d3a2
commit 17a0dfed5e
31 changed files with 603 additions and 131 deletions

View file

@ -13,8 +13,8 @@ use {
state::State,
text::{self, TextTexture},
tree::{
walker::NodeVisitor, ContainingNode, Direction, FindTreeResult, FoundNode, Node,
NodeId, ToplevelData, ToplevelNode, ToplevelNodeBase, WorkspaceNode,
walker::NodeVisitor, ContainingNode, Direction, FindTreeResult, FindTreeUsecase,
FoundNode, Node, NodeId, ToplevelData, ToplevelNode, ToplevelNodeBase, WorkspaceNode,
},
utils::{
clonecell::CloneCell,
@ -1131,7 +1131,13 @@ impl Node for ContainerNode {
self.toplevel_data.update_self_active(self, active);
}
fn node_find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
fn node_find_tree_at(
&self,
x: i32,
y: i32,
tree: &mut Vec<FoundNode>,
usecase: FindTreeUsecase,
) -> FindTreeResult {
let mut recurse = |content: Rect, child: NodeRef<ContainerChild>| {
if content.contains(x, y) {
let (x, y) = content.translate(x, y);
@ -1140,7 +1146,7 @@ impl Node for ContainerNode {
x,
y,
});
child.node.node_find_tree_at(x, y, tree);
child.node.node_find_tree_at(x, y, tree, usecase);
}
};
if let Some(child) = self.mono_child.get() {
@ -1329,6 +1335,10 @@ impl Node for ContainerNode {
fn node_is_container(&self) -> bool {
true
}
fn node_into_toplevel(self: Rc<Self>) -> Option<Rc<dyn ToplevelNode>> {
Some(self)
}
}
impl ContainingNode for ContainerNode {
@ -1549,6 +1559,10 @@ impl ToplevelNodeBase for ContainerNode {
}
}
}
fn tl_admits_children(&self) -> bool {
true
}
}
fn direction_to_split(dir: Direction) -> (ContainerSplit, bool) {