autocommit 2022-04-18 14:14:25 CEST
This commit is contained in:
parent
085ca95835
commit
54cf01f745
20 changed files with 155 additions and 109 deletions
|
|
@ -766,6 +766,10 @@ impl SizedNode for ContainerNode {
|
|||
self.visible.get()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
Some(self.parent.get())
|
||||
}
|
||||
|
||||
fn last_active_child(self: &Rc<Self>) -> Rc<dyn Node> {
|
||||
if let Some(last) = self.focus_history.last() {
|
||||
return last.node.clone().node_last_active_child();
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ impl SizedNode for DisplayNode {
|
|||
true
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn find_tree_at(&self, x: i32, y: i32, tree: &mut Vec<FoundNode>) -> FindTreeResult {
|
||||
let outputs = self.outputs.lock();
|
||||
for output in outputs.values() {
|
||||
|
|
|
|||
|
|
@ -352,6 +352,10 @@ impl SizedNode for FloatNode {
|
|||
self.visible.get()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
Some(self.workspace.get())
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.visible.set(visible);
|
||||
if let Some(child) = self.child.get() {
|
||||
|
|
|
|||
|
|
@ -303,6 +303,10 @@ impl SizedNode for OutputNode {
|
|||
true
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
Some(self.state.root.clone())
|
||||
}
|
||||
|
||||
fn last_active_child(self: &Rc<Self>) -> Rc<dyn Node> {
|
||||
if let Some(ws) = self.workspace.get() {
|
||||
return ws.last_active_child();
|
||||
|
|
@ -310,6 +314,12 @@ impl SizedNode for OutputNode {
|
|||
self.clone()
|
||||
}
|
||||
|
||||
fn do_focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
|
||||
if let Some(ws) = self.workspace.get() {
|
||||
ws.do_focus(seat, direction);
|
||||
}
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
self.global.pos.get()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use {
|
|||
linkedlist::{LinkedList, LinkedNode},
|
||||
},
|
||||
},
|
||||
jay_config::Direction,
|
||||
std::{cell::Cell, fmt::Debug, rc::Rc},
|
||||
};
|
||||
|
||||
|
|
@ -74,6 +75,10 @@ impl SizedNode for WorkspaceNode {
|
|||
self.visible.get()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<Rc<dyn Node>> {
|
||||
Some(self.output.get())
|
||||
}
|
||||
|
||||
fn last_active_child(self: &Rc<Self>) -> Rc<dyn Node> {
|
||||
if let Some(c) = self.container.get() {
|
||||
return c.last_active_child();
|
||||
|
|
@ -89,6 +94,12 @@ impl SizedNode for WorkspaceNode {
|
|||
self.seat_state.set_visible(self, visible);
|
||||
}
|
||||
|
||||
fn do_focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
|
||||
if let Some(container) = self.container.get() {
|
||||
container.do_focus(seat, direction);
|
||||
}
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
self.position.get()
|
||||
}
|
||||
|
|
@ -117,6 +128,10 @@ impl SizedNode for WorkspaceNode {
|
|||
renderer.render_workspace(self, x, y);
|
||||
}
|
||||
|
||||
fn into_workspace(self: &Rc<Self>) -> Option<Rc<WorkspaceNode>> {
|
||||
Some(self.clone())
|
||||
}
|
||||
|
||||
fn accepts_child(&self, node: &dyn Node) -> bool {
|
||||
node.node_is_container()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue