1
0
Fork 0
forked from wry/wry

tree: add Node::node_make_visible

This commit is contained in:
Julian Orth 2025-07-18 20:01:27 +02:00
parent 289c201a69
commit 4bfa9fb7fc
15 changed files with 147 additions and 34 deletions

View file

@ -1636,6 +1636,10 @@ impl Node for ContainerNode {
Some(self)
}
fn node_make_visible(self: Rc<Self>) {
self.toplevel_data.make_visible(&*self);
}
fn node_on_button(
self: Rc<Self>,
seat: &Rc<WlSeatGlobal>,
@ -1919,6 +1923,28 @@ impl ContainingNode for ContainerNode {
self.workspace.get()
}
fn cnode_make_visible(self: Rc<Self>, child: &dyn Node) {
let Some(child) = self
.child_nodes
.borrow()
.get(&child.node_id())
.map(|n| n.to_ref())
else {
return;
};
self.toplevel_data.make_visible(&*self);
if !self.node_visible() {
return;
}
let Some(cur) = self.mono_child.get() else {
return;
};
if cur.node.node_id() == child.node.node_id() {
return;
}
self.activate_child(&child);
}
fn cnode_set_child_position(self: Rc<Self>, child: &dyn Node, x: i32, y: i32) {
let Some(parent) = self.toplevel_data.parent.get() else {
return;

View file

@ -12,6 +12,7 @@ pub trait ContainingNode: Node {
fn cnode_accepts_child(&self, node: &dyn Node) -> bool;
fn cnode_child_attention_request_changed(self: Rc<Self>, child: &dyn Node, set: bool);
fn cnode_workspace(self: Rc<Self>) -> Rc<WorkspaceNode>;
fn cnode_make_visible(self: Rc<Self>, child: &dyn Node);
fn cnode_set_child_position(self: Rc<Self>, child: &dyn Node, x: i32, y: i32) {
let _ = child;
let _ = x;

View file

@ -752,6 +752,13 @@ impl Node for FloatNode {
renderer.render_floating(self, x, y)
}
fn node_make_visible(self: Rc<Self>) {
if self.visible.get() {
return;
}
self.workspace.get().cnode_make_visible(&*self);
}
fn node_on_button(
self: Rc<Self>,
seat: &Rc<WlSeatGlobal>,
@ -904,6 +911,10 @@ impl ContainingNode for FloatNode {
self.workspace.get()
}
fn cnode_make_visible(self: Rc<Self>, _child: &dyn Node) {
self.node_make_visible();
}
fn cnode_set_child_position(self: Rc<Self>, _child: &dyn Node, x: i32, y: i32) {
let theme = &self.state.theme;
let th = theme.sizes.title_height.get();

View file

@ -211,6 +211,10 @@ impl Node for PlaceholderNode {
Some(self)
}
fn node_make_visible(self: Rc<Self>) {
self.toplevel.make_visible(&*self);
}
fn node_on_pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
seat.pointer_cursor().set_known(KnownCursor::Default);
seat.enter_toplevel(self.clone());

View file

@ -866,6 +866,15 @@ impl ToplevelData {
self.property_changed(TL_CHANGED_CONTENT_TY);
}
}
pub fn make_visible(&self, slf: &dyn Node) {
if self.visible.get() {
return;
}
if let Some(parent) = self.parent.get() {
parent.cnode_make_visible(slf);
}
}
}
impl Drop for ToplevelData {

View file

@ -359,6 +359,13 @@ impl Node for WorkspaceNode {
renderer.render_workspace(self, x, y);
}
fn node_make_visible(self: Rc<Self>) {
if self.is_dummy {
return;
}
self.state.show_workspace2(None, &self);
}
fn node_on_pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
// log::info!("workspace focus");
seat.pointer_cursor().set_known(KnownCursor::Default);
@ -434,6 +441,10 @@ impl ContainingNode for WorkspaceNode {
fn cnode_workspace(self: Rc<Self>) -> Rc<WorkspaceNode> {
self
}
fn cnode_make_visible(self: Rc<Self>, _child: &dyn Node) {
self.node_make_visible();
}
}
pub struct WsMoveConfig {