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

@ -1818,6 +1818,12 @@ impl Node for WlSurface {
self.ext.get().tray_item()
}
fn node_make_visible(self: Rc<Self>) {
if let Some(tl) = self.toplevel.get() {
tl.node_make_visible();
}
}
fn node_on_key(
&self,
seat: &WlSeatGlobal,

View file

@ -212,6 +212,10 @@ impl<T: TrayItem> XdgPopupParent for Popup<T> {
self.parent.node_visible()
}
fn make_visible(self: Rc<Self>) {
// nothing
}
fn tray_item(&self) -> Option<TrayItemId> {
Some(self.parent.data().tray_item_id)
}

View file

@ -412,6 +412,10 @@ impl Node for Xwindow {
Some(self)
}
fn node_make_visible(self: Rc<Self>) {
self.toplevel_data.make_visible(&*self);
}
fn node_on_pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
seat.enter_toplevel(self.clone());
}

View file

@ -146,6 +146,12 @@ impl XdgPopupParent for Popup {
self.parent.surface.visible.get()
}
fn make_visible(self: Rc<Self>) {
if let Some(ext) = self.parent.ext.get() {
ext.make_visible();
}
}
fn tray_item(&self) -> Option<TrayItemId> {
self.parent.clone().tray_item()
}
@ -193,6 +199,8 @@ pub trait XdgSurfaceExt: Debug {
fn tray_item(&self) -> Option<TrayItemId> {
None
}
fn make_visible(self: Rc<Self>);
}
impl XdgSurface {

View file

@ -45,6 +45,7 @@ pub trait XdgPopupParent {
fn has_workspace_link(&self) -> bool;
fn post_commit(&self);
fn visible(&self) -> bool;
fn make_visible(self: Rc<Self>);
fn tray_item(&self) -> Option<TrayItemId> {
None
}
@ -344,6 +345,12 @@ impl Node for XdgPopup {
Some(self.xdg.surface.client.clone())
}
fn node_make_visible(self: Rc<Self>) {
if let Some(parent) = self.parent.get() {
parent.make_visible();
}
}
fn node_on_pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
seat.enter_popup(&self);
}
@ -430,6 +437,10 @@ impl XdgSurfaceExt for XdgPopup {
fn tray_item(&self) -> Option<TrayItemId> {
self.parent.get()?.tray_item()
}
fn make_visible(self: Rc<Self>) {
self.node_make_visible();
}
}
#[derive(Debug, Error)]

View file

@ -610,6 +610,10 @@ impl Node for XdgToplevel {
Some(self)
}
fn node_make_visible(self: Rc<Self>) {
self.toplevel_data.make_visible(&*self)
}
fn node_on_pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
seat.enter_toplevel(self.clone());
}
@ -780,6 +784,10 @@ impl XdgSurfaceExt for XdgToplevel {
.state
.damage(self.node_absolute_position());
}
fn make_visible(self: Rc<Self>) {
self.node_make_visible();
}
}
#[derive(Debug, Error)]

View file

@ -724,6 +724,10 @@ impl XdgPopupParent for Popup {
fn visible(&self) -> bool {
self.parent.node_visible()
}
fn make_visible(self: Rc<Self>) {
// nothing
}
}
object_base! {