1
0
Fork 0
forked from wry/wry

tree: add Node::node_location

This commit is contained in:
Julian Orth 2025-07-19 11:21:45 +02:00
parent f75051281b
commit 289c201a69
20 changed files with 152 additions and 45 deletions

View file

@ -11,8 +11,8 @@ use {
text::TextTexture,
tree::{
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
NodeVisitor, OutputNode, TileDragDestination, ToplevelData, ToplevelNode,
ToplevelNodeBase, ToplevelType, default_tile_drag_destination,
NodeLocation, NodeVisitor, OutputNode, TileDragDestination, ToplevelData, ToplevelNode,
ToplevelNodeBase, ToplevelType, WorkspaceNode, default_tile_drag_destination,
},
utils::{
asyncevent::AsyncEvent, errorfmt::ErrorFmt, on_drop_event::OnDropEvent,
@ -35,6 +35,7 @@ pub struct PlaceholderNode {
destroyed: Cell<bool>,
update_textures_scheduled: Cell<bool>,
state: Rc<State>,
location: Cell<Option<NodeLocation>>,
pub textures: RefCell<SmallMapMut<Scale, TextTexture, 2>>,
}
@ -63,6 +64,7 @@ impl PlaceholderNode {
destroyed: Default::default(),
update_textures_scheduled: Cell::new(false),
state: state.clone(),
location: Cell::new(node.node_location()),
textures: Default::default(),
}
}
@ -82,6 +84,7 @@ impl PlaceholderNode {
destroyed: Default::default(),
update_textures_scheduled: Default::default(),
state: state.clone(),
location: Default::default(),
textures: Default::default(),
}
}
@ -174,6 +177,10 @@ impl Node for PlaceholderNode {
self.toplevel.output_opt()
}
fn node_location(&self) -> Option<NodeLocation> {
self.location.get()
}
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
seat.focus_toplevel(self.clone());
}
@ -223,6 +230,10 @@ impl ToplevelNodeBase for PlaceholderNode {
&self.toplevel
}
fn tl_set_workspace_ext(&self, ws: &Rc<WorkspaceNode>) {
self.location.set(ws.node_location());
}
fn tl_change_extents_impl(self: Rc<Self>, rect: &Rect) {
self.toplevel.pos.set(*rect);
if let Some(p) = self.toplevel.parent.get() {