autocommit 2022-01-30 22:41:40 CET
This commit is contained in:
parent
f577f5feef
commit
865d5f295d
26 changed files with 1085 additions and 676 deletions
|
|
@ -1,12 +1,13 @@
|
|||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
use crate::tree::{FoundNode, Node, NodeId, WorkspaceNode};
|
||||
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
use crate::utils::linkedlist::{LinkedList, LinkedNode, NodeRef};
|
||||
use crate::{NumCell, State};
|
||||
use ahash::AHashMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
use crate::ifs::wl_seat::{NodeSeatState};
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
|
|
@ -44,6 +45,8 @@ pub struct ContainerNode {
|
|||
num_children: NumCell<usize>,
|
||||
pub children: LinkedList<ContainerChild>,
|
||||
child_nodes: RefCell<AHashMap<NodeId, LinkedNode<ContainerChild>>>,
|
||||
seat_state: NodeSeatState,
|
||||
workspace: CloneCell<Rc<WorkspaceNode>>,
|
||||
}
|
||||
|
||||
pub struct ContainerChild {
|
||||
|
|
@ -72,7 +75,8 @@ impl ContainerChild {
|
|||
}
|
||||
|
||||
impl ContainerNode {
|
||||
pub fn new(state: &State, parent: Rc<dyn Node>, child: Rc<dyn Node>) -> Self {
|
||||
pub fn new(state: &State, workspace: &Rc<WorkspaceNode>, parent: Rc<dyn Node>, child: Rc<dyn Node>) -> Self {
|
||||
child.clone().set_workspace(workspace);
|
||||
let children = LinkedList::new();
|
||||
let mut child_nodes = AHashMap::new();
|
||||
child_nodes.insert(
|
||||
|
|
@ -101,6 +105,8 @@ impl ContainerNode {
|
|||
num_children: NumCell::new(1),
|
||||
children,
|
||||
child_nodes: RefCell::new(child_nodes),
|
||||
seat_state: Default::default(),
|
||||
workspace: CloneCell::new(workspace.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,6 +155,7 @@ impl ContainerNode {
|
|||
}),
|
||||
);
|
||||
}
|
||||
new.clone().set_workspace(&self.workspace.get());
|
||||
let num_children = self.num_children.fetch_add(1) + 1;
|
||||
self.update_content_size();
|
||||
let new_child_factor = 1.0 / num_children as f64;
|
||||
|
|
@ -264,40 +271,46 @@ impl Node for ContainerNode {
|
|||
self.id.into()
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
let mut cn = self.child_nodes.borrow_mut();
|
||||
for (_, n) in cn.drain() {
|
||||
n.node.clear();
|
||||
}
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
||||
fn find_child_at(&self, x: i32, y: i32) -> Option<FoundNode> {
|
||||
fn destroy_node(&self, detach: bool) {
|
||||
if detach {
|
||||
self.parent.get().remove_child(self);
|
||||
}
|
||||
let mut cn = self.child_nodes.borrow_mut();
|
||||
for (_, n) in cn.drain() {
|
||||
n.node.destroy_node(false);
|
||||
}
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
|
||||
let mut recurse = |content: Rect, child: NodeRef<ContainerChild>| {
|
||||
if content.contains(x, y) {
|
||||
let (x, y) = content.translate(x, y);
|
||||
tree.push(
|
||||
FoundNode {
|
||||
node: child.node.clone(),
|
||||
x,
|
||||
y,
|
||||
}
|
||||
);
|
||||
child.node.find_tree_at(x, y, tree);
|
||||
}
|
||||
};
|
||||
if let Some(child) = self.mono_child.get() {
|
||||
if self.mono_body.get().contains(x, y) {
|
||||
let content = self.mono_content.get();
|
||||
let (x, y) = content.translate(x, y);
|
||||
return Some(FoundNode {
|
||||
node: child.node.clone(),
|
||||
x,
|
||||
y,
|
||||
contained: content.contains(x, y),
|
||||
});
|
||||
}
|
||||
return None;
|
||||
}
|
||||
for child in self.children.iter() {
|
||||
if child.body.get().contains(x, y) {
|
||||
let content = child.content.get();
|
||||
let (x, y) = content.translate(x, y);
|
||||
return Some(FoundNode {
|
||||
node: child.node.clone(),
|
||||
x,
|
||||
y,
|
||||
contained: content.contains(x, y),
|
||||
});
|
||||
recurse(self.mono_content.get(), child);
|
||||
} else {
|
||||
for child in self.children.iter() {
|
||||
if child.body.get().contains(x, y) {
|
||||
recurse(child.content.get(), child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
FindTreeResult::AcceptsInput
|
||||
}
|
||||
|
||||
fn remove_child(&self, child: &dyn Node) {
|
||||
|
|
@ -347,10 +360,6 @@ impl Node for ContainerNode {
|
|||
Some(self)
|
||||
}
|
||||
|
||||
fn get_workspace(self: Rc<Self>) -> Option<Rc<WorkspaceNode>> {
|
||||
self.parent.get().get_workspace()
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
self.abs_x1.set(rect.x1());
|
||||
self.abs_y1.set(rect.y1());
|
||||
|
|
@ -367,4 +376,11 @@ impl Node for ContainerNode {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
for child in self.children.iter() {
|
||||
child.node.clone().set_workspace(ws);
|
||||
}
|
||||
self.workspace.set(ws.clone());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
205
src/tree/mod.rs
205
src/tree/mod.rs
|
|
@ -1,6 +1,6 @@
|
|||
use crate::backend::{KeyState, Output, OutputId, ScrollAxis};
|
||||
use crate::fixed::Fixed;
|
||||
use crate::ifs::wl_seat::WlSeatGlobal;
|
||||
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
|
|
@ -10,9 +10,9 @@ use crate::NumCell;
|
|||
pub use container::*;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::Display;
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
pub use workspace::*;
|
||||
use crate::ifs::wl_surface::xdg_surface::xdg_popup::XdgPopup;
|
||||
|
||||
mod container;
|
||||
mod workspace;
|
||||
|
|
@ -51,14 +51,23 @@ impl Display for NodeId {
|
|||
}
|
||||
}
|
||||
|
||||
pub enum FindTreeResult {
|
||||
AcceptsInput,
|
||||
Other,
|
||||
}
|
||||
|
||||
pub trait AbsoluteNode: Node {
|
||||
fn into_node(self: Rc<Self>) -> Rc<dyn Node>;
|
||||
|
||||
fn absolute_position(&self) -> Rect;
|
||||
}
|
||||
|
||||
pub trait Node {
|
||||
fn id(&self) -> NodeId;
|
||||
fn seat_state(&self) -> &NodeSeatState;
|
||||
fn destroy_node(&self, detach: bool);
|
||||
|
||||
fn clear(&self) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
fn button(self: Rc<Self>, seat: &WlSeatGlobal, button: u32, state: KeyState) {
|
||||
fn button(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, button: u32, state: KeyState) {
|
||||
let _ = seat;
|
||||
let _ = button;
|
||||
let _ = state;
|
||||
|
|
@ -70,18 +79,19 @@ pub trait Node {
|
|||
let _ = axis;
|
||||
}
|
||||
|
||||
fn focus(self: Rc<Self>, seat: &WlSeatGlobal) {
|
||||
fn focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>) {
|
||||
let _ = seat;
|
||||
}
|
||||
|
||||
fn unfocus(self: Rc<Self>, seat: &WlSeatGlobal) {
|
||||
fn unfocus(&self, seat: &WlSeatGlobal) {
|
||||
let _ = seat;
|
||||
}
|
||||
|
||||
fn find_child_at(&self, x: i32, y: i32) -> Option<FoundNode> {
|
||||
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
|
||||
let _ = x;
|
||||
let _ = y;
|
||||
None
|
||||
let _ = tree;
|
||||
FindTreeResult::Other
|
||||
}
|
||||
|
||||
fn remove_child(&self, child: &dyn Node) {
|
||||
|
|
@ -96,7 +106,7 @@ pub trait Node {
|
|||
let _ = seat;
|
||||
}
|
||||
|
||||
fn enter(self: Rc<Self>, seat: &WlSeatGlobal, x: Fixed, y: Fixed) {
|
||||
fn enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
|
||||
let _ = seat;
|
||||
let _ = x;
|
||||
let _ = y;
|
||||
|
|
@ -126,33 +136,28 @@ pub trait Node {
|
|||
false
|
||||
}
|
||||
|
||||
fn get_workspace(self: Rc<Self>) -> Option<Rc<WorkspaceNode>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
let _ = rect;
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
let _ = ws;
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FoundNode {
|
||||
pub node: Rc<dyn Node>,
|
||||
pub x: i32,
|
||||
pub y: i32,
|
||||
pub contained: bool,
|
||||
}
|
||||
|
||||
tree_id!(ToplevelNodeId);
|
||||
|
||||
pub enum StackedNode {
|
||||
Float(Rc<FloatNode>),
|
||||
Popup(Rc<XdgPopup>),
|
||||
}
|
||||
|
||||
pub struct DisplayNode {
|
||||
pub id: NodeId,
|
||||
pub outputs: CopyHashMap<OutputId, Rc<OutputNode>>,
|
||||
pub stacked: LinkedList<StackedNode>,
|
||||
pub stacked: LinkedList<Rc<dyn AbsoluteNode>>,
|
||||
pub seat_state: NodeSeatState,
|
||||
}
|
||||
|
||||
impl DisplayNode {
|
||||
|
|
@ -161,6 +166,7 @@ impl DisplayNode {
|
|||
id,
|
||||
outputs: Default::default(),
|
||||
stacked: Default::default(),
|
||||
seat_state: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -170,35 +176,57 @@ impl Node for DisplayNode {
|
|||
self.id
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
let mut outputs = self.outputs.lock();
|
||||
for output in outputs.values() {
|
||||
output.clear();
|
||||
}
|
||||
outputs.clear();
|
||||
for floater in self.stacked.iter() {
|
||||
match &*floater {
|
||||
StackedNode::Float(f) => f.clear(),
|
||||
StackedNode::Popup(p) => p.clear(),
|
||||
}
|
||||
}
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
||||
fn find_child_at(&self, x: i32, y: i32) -> Option<FoundNode> {
|
||||
fn destroy_node(&self, _detach: bool) {
|
||||
let mut outputs = self.outputs.lock();
|
||||
for output in outputs.values() {
|
||||
output.destroy_node(false);
|
||||
}
|
||||
outputs.clear();
|
||||
for stacked in self.stacked.iter() {
|
||||
stacked.destroy_node(false);
|
||||
}
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
|
||||
for stacked in self.stacked.iter() {
|
||||
let ext = stacked.absolute_position();
|
||||
if !ext.contains(x, y) {
|
||||
continue;
|
||||
}
|
||||
let (x, y) = ext.translate(x, y);
|
||||
let idx = tree.len();
|
||||
tree.push(FoundNode {
|
||||
node: stacked.deref().clone().into_node(),
|
||||
x,
|
||||
y,
|
||||
});
|
||||
match stacked.find_tree_at(x, y, tree) {
|
||||
FindTreeResult::AcceptsInput => return FindTreeResult::AcceptsInput,
|
||||
FindTreeResult::Other => {
|
||||
tree.drain(idx..);
|
||||
}
|
||||
}
|
||||
}
|
||||
let outputs = self.outputs.lock();
|
||||
for output in outputs.values() {
|
||||
let pos = output.position.get();
|
||||
if pos.contains(x, y) {
|
||||
let (x, y) = pos.translate(x, y);
|
||||
return Some(FoundNode {
|
||||
tree.push(FoundNode {
|
||||
node: output.clone(),
|
||||
x,
|
||||
y,
|
||||
contained: true,
|
||||
});
|
||||
output.find_tree_at(x, y, tree);
|
||||
break;
|
||||
}
|
||||
}
|
||||
None
|
||||
FindTreeResult::AcceptsInput
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,6 +238,7 @@ pub struct OutputNode {
|
|||
pub backend: Rc<dyn Output>,
|
||||
pub workspaces: RefCell<Vec<Rc<WorkspaceNode>>>,
|
||||
pub workspace: CloneCell<Option<Rc<WorkspaceNode>>>,
|
||||
pub seat_state: NodeSeatState,
|
||||
}
|
||||
|
||||
impl Node for OutputNode {
|
||||
|
|
@ -217,34 +246,41 @@ impl Node for OutputNode {
|
|||
self.id.into()
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
||||
fn destroy_node(&self, detach: bool) {
|
||||
if detach {
|
||||
self.display.remove_child(self);
|
||||
}
|
||||
let mut workspaces = self.workspaces.borrow_mut();
|
||||
for workspace in workspaces.drain(..) {
|
||||
workspace.clear();
|
||||
workspace.destroy_node(false);
|
||||
}
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn find_child_at(&self, x: i32, y: i32) -> Option<FoundNode> {
|
||||
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
|
||||
if let Some(ws) = self.workspace.get() {
|
||||
Some(FoundNode {
|
||||
node: ws,
|
||||
tree.push(FoundNode {
|
||||
node: ws.clone(),
|
||||
x,
|
||||
y,
|
||||
contained: true,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
});
|
||||
ws.find_tree_at(x, y, tree);
|
||||
}
|
||||
}
|
||||
|
||||
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {
|
||||
renderer.render_output(self, x, y);
|
||||
FindTreeResult::AcceptsInput
|
||||
}
|
||||
|
||||
fn remove_child(&self, _child: &dyn Node) {
|
||||
self.workspace.set(None);
|
||||
}
|
||||
|
||||
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {
|
||||
renderer.render_output(self, x, y);
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
self.position.set(*rect);
|
||||
if let Some(c) = self.workspace.get() {
|
||||
|
|
@ -259,10 +295,21 @@ pub struct FloatNode {
|
|||
pub visible: Cell<bool>,
|
||||
pub position: Cell<Rect>,
|
||||
pub display: Rc<DisplayNode>,
|
||||
pub display_link: Cell<Option<LinkedNode<StackedNode>>>,
|
||||
pub workspace_link: Cell<Option<LinkedNode<StackedNode>>>,
|
||||
pub display_link: Cell<Option<LinkedNode<Rc<dyn AbsoluteNode>>>>,
|
||||
pub workspace_link: Cell<Option<LinkedNode<Rc<dyn AbsoluteNode>>>>,
|
||||
pub workspace: CloneCell<Rc<WorkspaceNode>>,
|
||||
pub child: CloneCell<Option<Rc<dyn Node>>>,
|
||||
pub seat_state: NodeSeatState,
|
||||
}
|
||||
|
||||
impl AbsoluteNode for FloatNode {
|
||||
fn into_node(self: Rc<Self>) -> Rc<dyn Node> {
|
||||
self
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
self.position.get()
|
||||
}
|
||||
}
|
||||
|
||||
impl Node for FloatNode {
|
||||
|
|
@ -270,12 +317,30 @@ impl Node for FloatNode {
|
|||
self.id.into()
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
self.child.set(None);
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
||||
fn find_child_at(&self, x: i32, y: i32) -> Option<FoundNode> {
|
||||
self.child.get().and_then(|c| c.find_child_at(x, y))
|
||||
fn destroy_node(&self, _detach: bool) {
|
||||
let _v = self.display_link.take();
|
||||
let _v = self.workspace_link.take();
|
||||
if let Some(child) = self.child.get() {
|
||||
child.destroy_node(false);
|
||||
}
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
|
||||
let child = match self.child.get() {
|
||||
Some(c) => c,
|
||||
_ => return FindTreeResult::Other,
|
||||
};
|
||||
tree.push(FoundNode {
|
||||
node: child.clone(),
|
||||
x,
|
||||
y,
|
||||
});
|
||||
child.find_tree_at(x, y, tree)
|
||||
}
|
||||
|
||||
fn remove_child(&self, _child: &dyn Node) {
|
||||
|
|
@ -284,6 +349,12 @@ impl Node for FloatNode {
|
|||
self.workspace_link.set(None);
|
||||
}
|
||||
|
||||
fn child_size_changed(&self, _child: &dyn Node, width: i32, height: i32) {
|
||||
let pos = self.position.get();
|
||||
self.position
|
||||
.set(Rect::new_sized(pos.x1(), pos.x2(), width, height).unwrap());
|
||||
}
|
||||
|
||||
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {
|
||||
renderer.render_floating(self, x, y)
|
||||
}
|
||||
|
|
@ -296,19 +367,17 @@ impl Node for FloatNode {
|
|||
true
|
||||
}
|
||||
|
||||
fn get_workspace(self: Rc<Self>) -> Option<Rc<WorkspaceNode>> {
|
||||
Some(self.workspace.get())
|
||||
}
|
||||
|
||||
fn child_size_changed(&self, _child: &dyn Node, width: i32, height: i32) {
|
||||
let pos = self.position.get();
|
||||
self.position
|
||||
.set(Rect::new_sized(pos.x1(), pos.x2(), width, height).unwrap());
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
if let Some(child) = self.child.get() {
|
||||
child.change_extents(rect);
|
||||
}
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
if let Some(c) = self.child.get() {
|
||||
c.set_workspace(ws);
|
||||
}
|
||||
self.workspace_link.set(Some(ws.stacked.add_last(self.clone())));
|
||||
self.workspace.set(ws.clone());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use std::ops::Deref;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
use crate::tree::container::ContainerNode;
|
||||
use crate::tree::{FoundNode, Node, NodeId, OutputNode, StackedNode};
|
||||
use crate::tree::{AbsoluteNode, FindTreeResult, FoundNode, Node, NodeId, OutputNode};
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
use crate::utils::linkedlist::LinkedList;
|
||||
use std::rc::Rc;
|
||||
use crate::rect::Rect;
|
||||
use crate::ifs::wl_seat::NodeSeatState;
|
||||
|
||||
tree_id!(WorkspaceNodeId);
|
||||
|
||||
|
|
@ -13,15 +13,15 @@ pub struct WorkspaceNode {
|
|||
pub id: WorkspaceNodeId,
|
||||
pub output: CloneCell<Rc<OutputNode>>,
|
||||
pub container: CloneCell<Option<Rc<ContainerNode>>>,
|
||||
pub stacked: LinkedList<StackedNode>,
|
||||
pub stacked: LinkedList<Rc<dyn AbsoluteNode>>,
|
||||
pub seat_state: NodeSeatState,
|
||||
}
|
||||
|
||||
impl WorkspaceNode {
|
||||
pub fn set_container(&self, container: &Rc<ContainerNode>) {
|
||||
pub fn set_container(self: &Rc<Self>, container: &Rc<ContainerNode>) {
|
||||
let output = self.output.get().position.get();
|
||||
container
|
||||
.clone()
|
||||
.change_extents(&output);
|
||||
container.clone().change_extents(&output);
|
||||
container.clone().set_workspace(self);
|
||||
self.container.set(Some(container.clone()));
|
||||
}
|
||||
}
|
||||
|
|
@ -31,48 +31,40 @@ impl Node for WorkspaceNode {
|
|||
self.id.into()
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
if let Some(child) = self.container.take() {
|
||||
child.clear();
|
||||
}
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
||||
fn find_child_at(&self, x: i32, y: i32) -> Option<FoundNode> {
|
||||
for stacked in self.stacked.rev_iter() {
|
||||
let (pos, node) = match stacked.deref() {
|
||||
StackedNode::Float(f) => (f.position.get(), &**f as &dyn Node),
|
||||
StackedNode::Popup(p) => (p.xdg.absolute_desired_extents.get(), &**p as &dyn Node),
|
||||
};
|
||||
if pos.contains(x, y) {
|
||||
let (x, y) = pos.translate(x, y);
|
||||
if let Some(n) = node.find_child_at(x, y) {
|
||||
return Some(n);
|
||||
}
|
||||
}
|
||||
fn destroy_node(&self, detach: bool) {
|
||||
if detach {
|
||||
self.output.get().remove_child(self);
|
||||
}
|
||||
match self.container.get() {
|
||||
Some(node) => Some(FoundNode {
|
||||
node,
|
||||
if let Some(container) = self.container.take() {
|
||||
container.destroy_node(false);
|
||||
}
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
|
||||
if let Some(n) = self.container.get() {
|
||||
tree.push(FoundNode {
|
||||
node: n.clone(),
|
||||
x,
|
||||
y,
|
||||
contained: true,
|
||||
}),
|
||||
_ => None,
|
||||
});
|
||||
n.find_tree_at(x, y, tree);
|
||||
}
|
||||
}
|
||||
|
||||
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {
|
||||
renderer.render_workspace(self, x, y);
|
||||
}
|
||||
|
||||
fn get_workspace(self: Rc<Self>) -> Option<Rc<WorkspaceNode>> {
|
||||
Some(self)
|
||||
FindTreeResult::AcceptsInput
|
||||
}
|
||||
|
||||
fn remove_child(&self, _child: &dyn Node) {
|
||||
self.container.set(None);
|
||||
}
|
||||
|
||||
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {
|
||||
renderer.render_workspace(self, x, y);
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
if let Some(c) = self.container.get() {
|
||||
c.change_extents(rect);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue