tree: add Node::node_output
This commit is contained in:
parent
0dcb33ae38
commit
b83bf0657b
15 changed files with 65 additions and 7 deletions
|
|
@ -1783,6 +1783,10 @@ impl Node for WlSurface {
|
|||
self.buffer_abs_pos.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
Some(self.output.get())
|
||||
}
|
||||
|
||||
fn node_active_changed(&self, active: bool) {
|
||||
if let Some(tl) = self.toplevel.get() {
|
||||
tl.tl_surface_active_changed(active);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use {
|
|||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
rect::Rect,
|
||||
tree::{FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeVisitor},
|
||||
tree::{FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeVisitor, OutputNode},
|
||||
utils::numcell::NumCell,
|
||||
wire::{ExtSessionLockSurfaceV1Id, WlSurfaceId, ext_session_lock_surface_v1::*},
|
||||
},
|
||||
|
|
@ -123,6 +123,10 @@ impl Node for ExtSessionLockSurfaceV1 {
|
|||
self.surface.node_absolute_position()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.output.node()
|
||||
}
|
||||
|
||||
fn node_find_tree_at(
|
||||
&self,
|
||||
x: i32,
|
||||
|
|
|
|||
|
|
@ -292,6 +292,10 @@ impl<T: TrayItem> Node for T {
|
|||
self.data().surface.node_absolute_position()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.data().output.node()
|
||||
}
|
||||
|
||||
fn node_find_tree_at(
|
||||
&self,
|
||||
x: i32,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use {
|
|||
state::State,
|
||||
tree::{
|
||||
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
|
||||
NodeVisitor, StackedNode, TileDragDestination, ToplevelData, ToplevelNode,
|
||||
NodeVisitor, OutputNode, StackedNode, TileDragDestination, ToplevelData, ToplevelNode,
|
||||
ToplevelNodeBase, WorkspaceNode, default_tile_drag_destination,
|
||||
},
|
||||
utils::{clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode},
|
||||
|
|
@ -346,6 +346,10 @@ impl Node for Xwindow {
|
|||
self.data.info.extents.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.toplevel_data.output_opt()
|
||||
}
|
||||
|
||||
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self.clone());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,6 +314,10 @@ impl Node for XdgPopup {
|
|||
self.xdg.absolute_desired_extents.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.xdg.workspace.get().map(|w| w.output.get())
|
||||
}
|
||||
|
||||
fn node_find_tree_at(
|
||||
&self,
|
||||
x: i32,
|
||||
|
|
|
|||
|
|
@ -523,6 +523,10 @@ impl Node for XdgToplevel {
|
|||
self.xdg.absolute_desired_extents.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.toplevel_data.output_opt()
|
||||
}
|
||||
|
||||
fn node_do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self.clone());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -648,6 +648,10 @@ impl Node for ZwlrLayerSurfaceV1 {
|
|||
self.pos.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.output.node()
|
||||
}
|
||||
|
||||
fn node_find_tree_at(
|
||||
&self,
|
||||
x: i32,
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ pub trait Node: 'static {
|
|||
fn node_visit_children(&self, visitor: &mut dyn NodeVisitor);
|
||||
fn node_visible(&self) -> bool;
|
||||
fn node_absolute_position(&self) -> Rect;
|
||||
#[expect(dead_code)]
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>>;
|
||||
|
||||
fn node_child_title_changed(self: Rc<Self>, child: &dyn Node, title: &str) {
|
||||
let _ = child;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use {
|
|||
text::TextTexture,
|
||||
tree::{
|
||||
ContainingNode, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
|
||||
TddType, TileDragDestination, ToplevelData, ToplevelNode, ToplevelNodeBase,
|
||||
OutputNode, TddType, TileDragDestination, ToplevelData, ToplevelNode, ToplevelNodeBase,
|
||||
WorkspaceNode, default_tile_drag_bounds, walker::NodeVisitor,
|
||||
},
|
||||
utils::{
|
||||
|
|
@ -1761,6 +1761,10 @@ impl Node for ContainerNode {
|
|||
fn node_is_container(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.toplevel_data.output_opt()
|
||||
}
|
||||
}
|
||||
|
||||
impl ContainingNode for ContainerNode {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,10 @@ impl Node for DisplayNode {
|
|||
self.extents.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn node_find_tree_at(
|
||||
&self,
|
||||
x: i32,
|
||||
|
|
|
|||
|
|
@ -697,6 +697,10 @@ impl Node for FloatNode {
|
|||
self.position.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
Some(self.workspace.get().output.get())
|
||||
}
|
||||
|
||||
fn node_child_title_changed(self: Rc<Self>, _child: &dyn Node, title: &str) {
|
||||
self.update_child_title(title);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1343,6 +1343,10 @@ impl Node for OutputNode {
|
|||
self.global.pos.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.global.opt.node()
|
||||
}
|
||||
|
||||
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() {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ use {
|
|||
text::TextTexture,
|
||||
tree::{
|
||||
ContainerSplit, Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId,
|
||||
NodeVisitor, TileDragDestination, ToplevelData, ToplevelNode, ToplevelNodeBase,
|
||||
default_tile_drag_destination,
|
||||
NodeVisitor, OutputNode, TileDragDestination, ToplevelData, ToplevelNode,
|
||||
ToplevelNodeBase, default_tile_drag_destination,
|
||||
},
|
||||
utils::{
|
||||
asyncevent::AsyncEvent, errorfmt::ErrorFmt, on_drop_event::OnDropEvent,
|
||||
|
|
@ -201,6 +201,10 @@ impl Node for PlaceholderNode {
|
|||
fn node_into_toplevel(self: Rc<Self>) -> Option<Rc<dyn ToplevelNode>> {
|
||||
Some(self)
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
self.toplevel.output_opt()
|
||||
}
|
||||
}
|
||||
|
||||
impl ToplevelNodeBase for PlaceholderNode {
|
||||
|
|
|
|||
|
|
@ -600,12 +600,16 @@ impl ToplevelData {
|
|||
}
|
||||
|
||||
pub fn output(&self) -> Rc<OutputNode> {
|
||||
match self.workspace.get() {
|
||||
match self.output_opt() {
|
||||
None => self.state.dummy_output.get().unwrap(),
|
||||
Some(ws) => ws.output.get(),
|
||||
Some(o) => o,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn output_opt(&self) -> Option<Rc<OutputNode>> {
|
||||
self.workspace.get().map(|ws| ws.output.get())
|
||||
}
|
||||
|
||||
pub fn desired_pixel_size(&self) -> (i32, i32) {
|
||||
let (dw, dh) = self.desired_extents.get().size();
|
||||
if let Some(ws) = self.workspace.get() {
|
||||
|
|
|
|||
|
|
@ -298,6 +298,10 @@ impl Node for WorkspaceNode {
|
|||
self.position.get()
|
||||
}
|
||||
|
||||
fn node_output(&self) -> Option<Rc<OutputNode>> {
|
||||
Some(self.output.get())
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue