1
0
Fork 0
forked from wry/wry

autocommit 2022-04-18 14:14:25 CEST

This commit is contained in:
Julian Orth 2022-04-18 14:14:25 +02:00
parent 085ca95835
commit 54cf01f745
20 changed files with 155 additions and 109 deletions

View file

@ -2,7 +2,7 @@ use {
crate::{
ifs::{wl_seat::SeatId, wl_surface::WlSurface},
tree::Node,
utils::{linkedlist::LinkedNode, numcell::NumCell, smallmap::SmallMap},
utils::{numcell::NumCell, smallmap::SmallMap},
},
std::rc::Rc,
};
@ -10,7 +10,6 @@ use {
tree_id!(ToplevelNodeId);
pub trait ToplevelNode {
fn data(&self) -> &ToplevelData;
fn parent(&self) -> Option<Rc<dyn Node>>;
fn as_node(&self) -> &dyn Node;
fn into_node(self: Rc<Self>) -> Rc<dyn Node>;
fn accepts_keyboard_focus(&self) -> bool;
@ -25,13 +24,11 @@ pub trait ToplevelNode {
pub struct ToplevelData {
pub active_surfaces: NumCell<u32>,
pub focus_surface: SmallMap<SeatId, Rc<WlSurface>, 1>,
pub toplevel_history: SmallMap<SeatId, LinkedNode<Rc<dyn ToplevelNode>>, 1>,
}
impl ToplevelData {
pub fn clear(&self) {
self.focus_surface.clear();
self.toplevel_history.clear();
}
}
@ -54,4 +51,8 @@ impl<'a> dyn ToplevelNode + 'a {
.get(&seat)
.unwrap_or_else(|| self.default_surface())
}
pub fn parent(&self) -> Option<Rc<dyn Node>> {
self.as_node().node_parent()
}
}