autocommit 2022-01-29 23:08:25 CET
This commit is contained in:
parent
11d3604de4
commit
f577f5feef
18 changed files with 484 additions and 173 deletions
|
|
@ -1,9 +1,11 @@
|
|||
use std::ops::Deref;
|
||||
use crate::render::Renderer;
|
||||
use crate::tree::container::ContainerNode;
|
||||
use crate::tree::{FloatNode, FoundNode, Node, NodeId, OutputNode};
|
||||
use crate::tree::{FoundNode, Node, NodeId, OutputNode, StackedNode};
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
use crate::utils::linkedlist::LinkedList;
|
||||
use std::rc::Rc;
|
||||
use crate::rect::Rect;
|
||||
|
||||
tree_id!(WorkspaceNodeId);
|
||||
|
||||
|
|
@ -11,7 +13,7 @@ pub struct WorkspaceNode {
|
|||
pub id: WorkspaceNodeId,
|
||||
pub output: CloneCell<Rc<OutputNode>>,
|
||||
pub container: CloneCell<Option<Rc<ContainerNode>>>,
|
||||
pub floaters: LinkedList<Rc<FloatNode>>,
|
||||
pub stacked: LinkedList<StackedNode>,
|
||||
}
|
||||
|
||||
impl WorkspaceNode {
|
||||
|
|
@ -19,7 +21,7 @@ impl WorkspaceNode {
|
|||
let output = self.output.get().position.get();
|
||||
container
|
||||
.clone()
|
||||
.change_size(output.width(), output.height());
|
||||
.change_extents(&output);
|
||||
self.container.set(Some(container.clone()));
|
||||
}
|
||||
}
|
||||
|
|
@ -36,6 +38,18 @@ impl Node for WorkspaceNode {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
match self.container.get() {
|
||||
Some(node) => Some(FoundNode {
|
||||
node,
|
||||
|
|
@ -59,9 +73,9 @@ impl Node for WorkspaceNode {
|
|||
self.container.set(None);
|
||||
}
|
||||
|
||||
fn change_size(self: Rc<Self>, width: i32, height: i32) {
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
if let Some(c) = self.container.get() {
|
||||
c.change_size(width, height);
|
||||
c.change_extents(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue