1
0
Fork 0
forked from wry/wry

tree: add Node::node_layer

This commit is contained in:
Julian Orth 2025-07-19 21:57:47 +02:00
parent a5e8b39e4f
commit dbc954dded
19 changed files with 294 additions and 46 deletions

View file

@ -18,9 +18,9 @@ use {
text::TextTexture,
tree::{
ContainingNode, Direction, FindTreeResult, FindTreeUsecase, FloatNode, FoundNode, Node,
NodeId, NodeLocation, OutputNode, TddType, TileDragDestination, ToplevelData,
ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode, default_tile_drag_bounds,
toplevel_set_floating, walker::NodeVisitor,
NodeId, NodeLayerLink, NodeLocation, OutputNode, TddType, TileDragDestination,
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode,
default_tile_drag_bounds, toplevel_set_floating, walker::NodeVisitor,
},
utils::{
asyncevent::AsyncEvent,
@ -1553,6 +1553,10 @@ impl Node for ContainerNode {
Some(self.location.get())
}
fn node_layer(&self) -> NodeLayerLink {
self.toplevel_data.node_layer()
}
fn node_child_title_changed(self: Rc<Self>, child: &dyn Node, title: &str) {
if let Some(child) = self.child_nodes.borrow().get(&child.node_id()) {
self.update_child_title(child, title);

View file

@ -8,9 +8,9 @@ use {
renderer::Renderer,
state::State,
tree::{
FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLocation, OutputNode,
StackedNode, TileDragDestination, WorkspaceDragDestination, WorkspaceNodeId,
walker::NodeVisitor,
FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLayerLink, NodeLocation,
OutputNode, StackedNode, TileDragDestination, WorkspaceDragDestination,
WorkspaceNodeId, walker::NodeVisitor,
},
utils::{copyhashmap::CopyHashMap, linkedlist::LinkedList},
},
@ -157,6 +157,10 @@ impl Node for DisplayNode {
None
}
fn node_layer(&self) -> NodeLayerLink {
NodeLayerLink::Display
}
fn node_find_tree_at(
&self,
x: i32,

View file

@ -15,8 +15,8 @@ use {
text::TextTexture,
tree::{
ContainingNode, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
NodeLocation, OutputNode, PinnedNode, StackedNode, TileDragDestination, ToplevelNode,
WorkspaceNode, toplevel_set_floating, walker::NodeVisitor,
NodeLayerLink, NodeLocation, OutputNode, PinnedNode, StackedNode, TileDragDestination,
ToplevelNode, WorkspaceNode, toplevel_set_floating, walker::NodeVisitor,
},
utils::{
asyncevent::AsyncEvent, clonecell::CloneCell, double_click_state::DoubleClickState,
@ -709,6 +709,13 @@ impl Node for FloatNode {
Some(self.location.get())
}
fn node_layer(&self) -> NodeLayerLink {
let Some(l) = self.display_link.borrow().as_ref().map(|l| l.to_ref()) else {
return NodeLayerLink::Display;
};
NodeLayerLink::Stacked(l)
}
fn node_child_title_changed(self: Rc<Self>, _child: &dyn Node, title: &str) {
self.update_child_title(title);
}

View file

@ -43,9 +43,9 @@ use {
state::State,
text::TextTexture,
tree::{
Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLocation,
PinnedNode, StackedNode, TddType, TileDragDestination, WorkspaceDragDestination,
WorkspaceNode, WorkspaceNodeId, walker::NodeVisitor,
Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeLayerLink,
NodeLocation, PinnedNode, StackedNode, TddType, TileDragDestination,
WorkspaceDragDestination, WorkspaceNode, WorkspaceNodeId, walker::NodeVisitor,
},
utils::{
asyncevent::AsyncEvent, bitflags::BitflagsExt, clonecell::CloneCell,
@ -1478,6 +1478,10 @@ impl Node for OutputNode {
Some(NodeLocation::Output(self.id))
}
fn node_layer(&self) -> NodeLayerLink {
NodeLayerLink::Output
}
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
if self.state.lock.locked.get() {
if let Some(lock) = self.lock_surface.get() {

View file

@ -11,8 +11,9 @@ use {
text::TextTexture,
tree::{
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
NodeLocation, NodeVisitor, OutputNode, TileDragDestination, ToplevelData, ToplevelNode,
ToplevelNodeBase, ToplevelType, WorkspaceNode, default_tile_drag_destination,
NodeLayerLink, NodeLocation, NodeVisitor, OutputNode, TileDragDestination,
ToplevelData, ToplevelNode, ToplevelNodeBase, ToplevelType, WorkspaceNode,
default_tile_drag_destination,
},
utils::{
asyncevent::AsyncEvent, errorfmt::ErrorFmt, on_drop_event::OnDropEvent,
@ -181,6 +182,10 @@ impl Node for PlaceholderNode {
self.location.get()
}
fn node_layer(&self) -> NodeLayerLink {
self.toplevel.node_layer()
}
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
seat.focus_toplevel(self.clone());
}

View file

@ -28,7 +28,7 @@ use {
state::State,
tree::{
ContainerNode, ContainerSplit, ContainingNode, Direction, FloatNode, Node, NodeId,
OutputNode, PlaceholderNode, WorkspaceNode,
NodeLayerLink, OutputNode, PlaceholderNode, WorkspaceNode,
},
utils::{
array_to_tuple::ArrayToTuple,
@ -902,6 +902,16 @@ impl ToplevelData {
parent.cnode_make_visible(slf);
}
}
pub fn node_layer(&self) -> NodeLayerLink {
if self.self_or_ancestor_is_fullscreen.get() {
return NodeLayerLink::Fullscreen;
}
if let Some(float) = self.float.get() {
return float.node_layer();
}
NodeLayerLink::Tiled
}
}
impl Drop for ToplevelData {

View file

@ -21,8 +21,9 @@ use {
text::TextTexture,
tree::{
ContainingNode, Direction, FindTreeResult, FindTreeUsecase, FloatNode, FoundNode, Node,
NodeId, NodeLocation, NodeVisitorBase, OutputNode, OutputNodeId, PlaceholderNode,
StackedNode, ToplevelNode, container::ContainerNode, walker::NodeVisitor,
NodeId, NodeLayerLink, NodeLocation, NodeVisitorBase, OutputNode, OutputNodeId,
PlaceholderNode, StackedNode, ToplevelNode, container::ContainerNode,
walker::NodeVisitor,
},
utils::{
clonecell::CloneCell,
@ -321,6 +322,10 @@ impl Node for WorkspaceNode {
Some(self.location())
}
fn node_layer(&self) -> NodeLayerLink {
NodeLayerLink::Workspace
}
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
if let Some(fs) = self.fullscreen.get() {
fs.node_do_focus(seat, direction);