autocommit 2022-02-11 02:28:11 CET
This commit is contained in:
parent
83c3fb99f9
commit
9b8e1ac29f
63 changed files with 690 additions and 122 deletions
|
|
@ -10,6 +10,7 @@ use crate::utils::linkedlist::{LinkedList, LinkedNode, NodeRef};
|
|||
use crate::{NumCell, State};
|
||||
use ahash::AHashMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::mem;
|
||||
use std::ops::DerefMut;
|
||||
use std::rc::Rc;
|
||||
|
|
@ -55,6 +56,12 @@ pub struct ContainerNode {
|
|||
seats: RefCell<AHashMap<SeatId, SeatState>>,
|
||||
}
|
||||
|
||||
impl Debug for ContainerNode {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("ContainerNode").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ContainerChild {
|
||||
pub node: Rc<dyn Node>,
|
||||
pub body: Cell<Rect>,
|
||||
|
|
@ -318,7 +325,7 @@ impl ContainerNode {
|
|||
dist_left,
|
||||
dist_right,
|
||||
} => {
|
||||
let prev = op.child.prev();
|
||||
let prev = op.child.prev().unwrap();
|
||||
let prev_body = prev.body.get();
|
||||
let child_body = op.child.body.get();
|
||||
let (prev_factor, child_factor) = match self.split.get() {
|
||||
|
|
@ -458,7 +465,7 @@ impl Node for ContainerNode {
|
|||
if seat_data.x < body.x2() {
|
||||
let op = if seat_data.x < body.x1() {
|
||||
SeatOpKind::Resize {
|
||||
dist_left: seat_data.x - child.prev().body.get().x2(),
|
||||
dist_left: seat_data.x - child.prev().unwrap().body.get().x2(),
|
||||
dist_right: body.x1() - seat_data.x,
|
||||
}
|
||||
} else {
|
||||
|
|
@ -473,7 +480,7 @@ impl Node for ContainerNode {
|
|||
if seat_data.y < body.y1() {
|
||||
let op = if seat_data.y < body.y1() - CONTAINER_TITLE_HEIGHT {
|
||||
SeatOpKind::Resize {
|
||||
dist_left: seat_data.y - child.prev().body.get().y2(),
|
||||
dist_left: seat_data.y - child.prev().unwrap().body.get().y2(),
|
||||
dist_right: body.y1() - seat_data.y,
|
||||
}
|
||||
} else {
|
||||
|
|
@ -528,6 +535,7 @@ impl Node for ContainerNode {
|
|||
};
|
||||
let num_children = self.num_children.fetch_sub(1) - 1;
|
||||
if num_children == 0 {
|
||||
self.seats.borrow_mut().clear();
|
||||
self.parent.get().remove_child(self);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use crate::xkbcommon::ModifierState;
|
|||
use crate::NumCell;
|
||||
pub use container::*;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::Display;
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
pub use workspace::*;
|
||||
|
|
@ -306,6 +306,12 @@ pub struct OutputNode {
|
|||
pub seat_state: NodeSeatState,
|
||||
}
|
||||
|
||||
impl Debug for OutputNode {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("OutputNode").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl Node for OutputNode {
|
||||
fn id(&self) -> NodeId {
|
||||
self.id.into()
|
||||
|
|
@ -375,6 +381,12 @@ pub struct FloatNode {
|
|||
pub seat_state: NodeSeatState,
|
||||
}
|
||||
|
||||
impl Debug for FloatNode {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("FloatNode").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl Node for FloatNode {
|
||||
fn id(&self) -> NodeId {
|
||||
self.id.into()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use crate::tree::container::ContainerNode;
|
|||
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, OutputNode};
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
use crate::utils::linkedlist::LinkedList;
|
||||
use std::fmt::Debug;
|
||||
use std::rc::Rc;
|
||||
|
||||
tree_id!(WorkspaceNodeId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue