autocommit 2022-02-21 23:21:13 CET
This commit is contained in:
parent
1cbc7a6445
commit
145d1c15b7
31 changed files with 1455 additions and 252 deletions
|
|
@ -4,6 +4,7 @@ use crate::ifs::wl_surface::WlSurface;
|
|||
use crate::tree::{ContainerNode, FloatNode, Node, OutputNode, WorkspaceNode};
|
||||
use crate::DisplayNode;
|
||||
use std::rc::Rc;
|
||||
use crate::ifs::wl_surface::zwlr_layer_surface_v1::ZwlrLayerSurfaceV1;
|
||||
|
||||
pub trait NodeVisitorBase: Sized {
|
||||
fn visit_surface(&mut self, node: &Rc<WlSurface>) {
|
||||
|
|
@ -37,6 +38,10 @@ pub trait NodeVisitorBase: Sized {
|
|||
fn visit_workspace(&mut self, node: &Rc<WorkspaceNode>) {
|
||||
node.visit_children(self);
|
||||
}
|
||||
|
||||
fn visit_layer_surface(&mut self, node: &Rc<ZwlrLayerSurfaceV1>) {
|
||||
node.visit_children(self);
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NodeVisitor {
|
||||
|
|
@ -48,6 +53,7 @@ pub trait NodeVisitor {
|
|||
fn visit_output(&mut self, node: &Rc<OutputNode>);
|
||||
fn visit_float(&mut self, node: &Rc<FloatNode>);
|
||||
fn visit_workspace(&mut self, node: &Rc<WorkspaceNode>);
|
||||
fn visit_layer_surface(&mut self, node: &Rc<ZwlrLayerSurfaceV1>);
|
||||
}
|
||||
|
||||
impl<T: NodeVisitorBase> NodeVisitor for T {
|
||||
|
|
@ -82,6 +88,10 @@ impl<T: NodeVisitorBase> NodeVisitor for T {
|
|||
fn visit_workspace(&mut self, node: &Rc<WorkspaceNode>) {
|
||||
<T as NodeVisitorBase>::visit_workspace(self, node)
|
||||
}
|
||||
|
||||
fn visit_layer_surface(&mut self, node: &Rc<ZwlrLayerSurfaceV1>) {
|
||||
<T as NodeVisitorBase>::visit_layer_surface(self, node)
|
||||
}
|
||||
}
|
||||
|
||||
// pub fn visit_containers<F: FnMut(&Rc<ContainerNode>)>(f: F) -> impl NodeVisitor {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue