autocommit 2022-04-23 01:40:39 CEST
This commit is contained in:
parent
e3b3d848c3
commit
025efbaccc
4 changed files with 19 additions and 45 deletions
|
|
@ -134,7 +134,6 @@ pub struct Xwindow {
|
|||
pub seat_state: NodeSeatState,
|
||||
pub data: Rc<XwindowData>,
|
||||
pub surface: Rc<WlSurface>,
|
||||
pub parent_node: CloneCell<Option<Rc<dyn Node>>>,
|
||||
pub display_link: RefCell<Option<LinkedNode<Rc<dyn StackedNode>>>>,
|
||||
pub toplevel_data: ToplevelData,
|
||||
}
|
||||
|
|
@ -184,7 +183,7 @@ impl XwindowData {
|
|||
pub fn title_changed(&self) {
|
||||
let title = self.info.title.borrow_mut();
|
||||
if let Some(w) = self.window.get() {
|
||||
if let Some(p) = w.parent_node.get() {
|
||||
if let Some(p) = w.toplevel_data.parent.get() {
|
||||
p.node_child_title_changed(w.deref(), title.as_deref().unwrap_or(""));
|
||||
}
|
||||
}
|
||||
|
|
@ -204,7 +203,6 @@ impl Xwindow {
|
|||
seat_state: Default::default(),
|
||||
data: data.clone(),
|
||||
surface: surface.clone(),
|
||||
parent_node: Default::default(),
|
||||
display_link: Default::default(),
|
||||
toplevel_data: ToplevelData::new(
|
||||
&data.state,
|
||||
|
|
@ -234,26 +232,8 @@ impl Xwindow {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn notify_parent(&self) {
|
||||
let parent = match self.parent_node.get() {
|
||||
Some(p) => p,
|
||||
_ => return,
|
||||
};
|
||||
let extents = self.surface.extents.get();
|
||||
parent.clone().node_child_active_changed(
|
||||
self,
|
||||
self.toplevel_data.active_children.get() > 0,
|
||||
1,
|
||||
);
|
||||
parent.node_child_size_changed(self, extents.width(), extents.height());
|
||||
parent.node_child_title_changed(
|
||||
self,
|
||||
self.data.info.title.borrow_mut().as_deref().unwrap_or(""),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn is_mapped(&self) -> bool {
|
||||
self.parent_node.get().is_some() || self.display_link.borrow_mut().is_some()
|
||||
self.toplevel_data.parent.get().is_some() || self.display_link.borrow_mut().is_some()
|
||||
}
|
||||
|
||||
pub fn may_be_mapped(&self) -> bool {
|
||||
|
|
@ -327,7 +307,7 @@ impl SurfaceExt for Xwindow {
|
|||
}
|
||||
|
||||
fn extents_changed(&self) {
|
||||
self.notify_parent();
|
||||
self.tl_notify_parent();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +392,7 @@ impl ToplevelNode for Xwindow {
|
|||
}
|
||||
|
||||
fn tl_set_active(&self, active: bool) {
|
||||
if let Some(pn) = self.parent_node.get() {
|
||||
if let Some(pn) = self.toplevel_data.parent.get() {
|
||||
pn.node_child_active_changed(self, active, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ use {
|
|||
},
|
||||
},
|
||||
ahash::AHashMap,
|
||||
backtrace::Backtrace,
|
||||
isnt::std_1::vec::IsntVecExt,
|
||||
jay_config::{Axis, Direction},
|
||||
smallvec::SmallVec,
|
||||
|
|
@ -280,7 +279,6 @@ impl ContainerNode {
|
|||
let mut links = self.child_nodes.borrow_mut();
|
||||
if links.contains_key(&new.node_id()) {
|
||||
log::error!("Tried to add a child to a container that already contains the child");
|
||||
log::error!("\n{:?}", Backtrace::new());
|
||||
return;
|
||||
}
|
||||
let link = f(ContainerChild {
|
||||
|
|
@ -942,6 +940,16 @@ impl Node for ContainerNode {
|
|||
self.toplevel_data.visible.get()
|
||||
}
|
||||
|
||||
fn node_absolute_position(&self) -> Rect {
|
||||
Rect::new_sized(
|
||||
self.abs_x1.get(),
|
||||
self.abs_y1.get(),
|
||||
self.width.get(),
|
||||
self.height.get(),
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn node_child_title_changed(self: Rc<Self>, child: &dyn Node, title: &str) {
|
||||
let child = match self.child_nodes.borrow_mut().get(&child.node_id()) {
|
||||
Some(cn) => cn.to_ref(),
|
||||
|
|
@ -980,16 +988,6 @@ impl Node for ContainerNode {
|
|||
}
|
||||
}
|
||||
|
||||
fn node_absolute_position(&self) -> Rect {
|
||||
Rect::new_sized(
|
||||
self.abs_x1.get(),
|
||||
self.abs_y1.get(),
|
||||
self.width.get(),
|
||||
self.height.get(),
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn node_active_changed(&self, active: bool) {
|
||||
self.toplevel_data.active.set(active);
|
||||
self.parent.get().node_child_active_changed(self, active, 1);
|
||||
|
|
@ -1316,6 +1314,10 @@ impl ToplevelNode for ContainerNode {
|
|||
.map(|tl| tl.tl_into_node())
|
||||
}
|
||||
|
||||
fn tl_after_parent_set(&self, parent: Rc<dyn ContainingNode>) {
|
||||
self.parent.set(parent);
|
||||
}
|
||||
|
||||
fn tl_set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
self.toplevel_data.workspace.set(Some(ws.clone()));
|
||||
for child in self.children.iter() {
|
||||
|
|
@ -1381,10 +1383,6 @@ impl ToplevelNode for ContainerNode {
|
|||
}
|
||||
self
|
||||
}
|
||||
|
||||
fn tl_after_parent_set(&self, parent: Rc<dyn ContainingNode>) {
|
||||
self.parent.set(parent);
|
||||
}
|
||||
}
|
||||
|
||||
fn direction_to_split(dir: Direction) -> (ContainerSplit, bool) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl PlaceholderNode {
|
|||
pub fn new_for(state: &Rc<State>, node: Rc<dyn ToplevelNode>) -> Self {
|
||||
Self {
|
||||
id: state.node_ids.next(),
|
||||
toplevel: ToplevelData::new(state, node.tl_title(), node.node_client()),
|
||||
toplevel: ToplevelData::new(state, node.tl_data().title.borrow_mut().clone(), node.node_client()),
|
||||
destroyed: Default::default(),
|
||||
texture: Default::default(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,6 @@ pub trait ToplevelNode: Node {
|
|||
}
|
||||
}
|
||||
|
||||
fn tl_title(&self) -> String {
|
||||
self.tl_data().title.borrow_mut().clone()
|
||||
}
|
||||
|
||||
fn tl_title_changed(&self) {
|
||||
let data = self.tl_data();
|
||||
let title = data.title.borrow_mut();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue