autocommit 2022-04-12 17:26:33 CEST
This commit is contained in:
parent
d9d1addbf5
commit
8924936079
26 changed files with 896 additions and 543 deletions
|
|
@ -18,7 +18,7 @@ use {
|
|||
leaks::Tracker,
|
||||
object::Object,
|
||||
rect::Rect,
|
||||
tree::{FindTreeResult, FoundNode, Node, WorkspaceNode},
|
||||
tree::{FindTreeResult, FoundNode, Node, SizedNode, WorkspaceNode},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
clonecell::CloneCell,
|
||||
|
|
@ -301,9 +301,9 @@ impl XdgSurface {
|
|||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.surface.set_visible(visible);
|
||||
self.surface.node_set_visible(visible);
|
||||
for popup in self.popups.lock().values() {
|
||||
popup.set_visible(visible);
|
||||
popup.node_set_visible(visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use {
|
|||
object::Object,
|
||||
rect::Rect,
|
||||
render::Renderer,
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, WorkspaceNode},
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, SizedNode, WorkspaceNode},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
clonecell::CloneCell,
|
||||
|
|
@ -201,7 +201,7 @@ impl XdgPopup {
|
|||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.xdg.surface.client.parse(self, parser)?;
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
{
|
||||
if let Some(parent) = self.parent.take() {
|
||||
parent.popups.remove(&self.id);
|
||||
|
|
@ -255,7 +255,7 @@ impl Object for XdgPopup {
|
|||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.parent.set(None);
|
||||
*self.display_link.borrow_mut() = None;
|
||||
*self.workspace_link.borrow_mut() = None;
|
||||
|
|
@ -264,7 +264,7 @@ impl Object for XdgPopup {
|
|||
|
||||
simple_add_obj!(XdgPopup);
|
||||
|
||||
impl Node for XdgPopup {
|
||||
impl SizedNode for XdgPopup {
|
||||
fn id(&self) -> NodeId {
|
||||
self.node_id.into()
|
||||
}
|
||||
|
|
@ -280,8 +280,8 @@ impl Node for XdgPopup {
|
|||
self.xdg.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_popup(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_popup(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
|
|
@ -314,7 +314,7 @@ impl Node for XdgPopup {
|
|||
self.xdg.find_tree_at(x, y, tree)
|
||||
}
|
||||
|
||||
fn pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
fn pointer_enter(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_popup(&self);
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ impl Node for XdgPopup {
|
|||
renderer.render_xdg_surface(&self.xdg, x, y)
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
fn set_workspace(self: &Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
self.xdg.set_workspace(ws);
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +363,7 @@ impl XdgSurfaceExt for XdgPopup {
|
|||
*wl = Some(ws.stacked.add_last(self.clone()));
|
||||
*dl = Some(state.root.stacked.add_last(self.clone()));
|
||||
state.tree_changed();
|
||||
self.set_visible(
|
||||
self.node_set_visible(
|
||||
self.parent
|
||||
.get()
|
||||
.map(|p| p.surface.visible.get())
|
||||
|
|
@ -374,8 +374,8 @@ impl XdgSurfaceExt for XdgPopup {
|
|||
if wl.take().is_some() {
|
||||
drop(wl);
|
||||
drop(dl);
|
||||
self.set_visible(false);
|
||||
self.destroy_node(true);
|
||||
self.node_set_visible(false);
|
||||
self.node_destroy(true);
|
||||
self.send_popup_done();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ use {
|
|||
rect::Rect,
|
||||
render::Renderer,
|
||||
tree::{
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
|
||||
ToplevelNodeId, WorkspaceNode,
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, SizedNode, ToplevelData,
|
||||
ToplevelNode, ToplevelNodeId, WorkspaceNode,
|
||||
},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -160,7 +160,7 @@ impl XdgToplevel {
|
|||
|
||||
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?;
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.xdg.ext.set(None);
|
||||
{
|
||||
let mut children = self.children.borrow_mut();
|
||||
|
|
@ -202,7 +202,7 @@ impl XdgToplevel {
|
|||
title.clear();
|
||||
title.push_str(req.title);
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
parent.child_title_changed(self, &title);
|
||||
parent.node_child_title_changed(self, &title);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -222,7 +222,7 @@ impl XdgToplevel {
|
|||
let req: Move = self.xdg.surface.client.parse(self, parser)?;
|
||||
let seat = self.xdg.surface.client.lookup(req.seat)?;
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if let Some(float) = parent.into_float() {
|
||||
if let Some(float) = parent.node_into_float() {
|
||||
seat.move_(&float);
|
||||
}
|
||||
}
|
||||
|
|
@ -311,9 +311,9 @@ impl XdgToplevel {
|
|||
let extents = self.xdg.extents.get();
|
||||
parent
|
||||
.clone()
|
||||
.child_active_changed(self, self.toplevel_data.active_surfaces.get() > 0);
|
||||
parent.child_size_changed(self, extents.width(), extents.height());
|
||||
parent.child_title_changed(self, self.title.borrow_mut().deref());
|
||||
.node_child_active_changed(self, self.toplevel_data.active_surfaces.get() > 0);
|
||||
parent.node_child_size_changed(self, extents.width(), extents.height());
|
||||
parent.node_child_title_changed(self, self.title.borrow_mut().deref());
|
||||
}
|
||||
|
||||
fn map_floating(self: &Rc<Self>, workspace: &Rc<WorkspaceNode>) {
|
||||
|
|
@ -360,7 +360,7 @@ impl Object for XdgToplevel {
|
|||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.parent.set(None);
|
||||
let _children = mem::take(&mut *self.children.borrow_mut());
|
||||
}
|
||||
|
|
@ -368,15 +368,11 @@ impl Object for XdgToplevel {
|
|||
|
||||
dedicated_add_obj!(XdgToplevel, XdgToplevelId, xdg_toplevel);
|
||||
|
||||
impl Node for XdgToplevel {
|
||||
impl SizedNode for XdgToplevel {
|
||||
fn id(&self) -> NodeId {
|
||||
self.node_id.into()
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.send_close();
|
||||
}
|
||||
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.xdg.seat_state
|
||||
}
|
||||
|
|
@ -384,7 +380,7 @@ impl Node for XdgToplevel {
|
|||
fn destroy_node(&self, detach: bool) {
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
if detach {
|
||||
parent.remove_child(self);
|
||||
parent.node_remove_child(self);
|
||||
self.xdg.surface.client.state.tree_changed();
|
||||
}
|
||||
}
|
||||
|
|
@ -393,8 +389,8 @@ impl Node for XdgToplevel {
|
|||
self.xdg.seat_state.destroy_node(self)
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_toplevel(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_toplevel(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
|
|
@ -416,16 +412,20 @@ impl Node for XdgToplevel {
|
|||
|
||||
fn is_contained_in(&self, other: NodeId) -> bool {
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if parent.id() == other {
|
||||
if parent.node_id() == other {
|
||||
return true;
|
||||
}
|
||||
return parent.is_contained_in(other);
|
||||
return parent.node_is_contained_in(other);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self);
|
||||
fn do_focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.send_close();
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
|
|
@ -436,8 +436,8 @@ impl Node for XdgToplevel {
|
|||
self.xdg.find_tree_at(x, y, tree)
|
||||
}
|
||||
|
||||
fn pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self);
|
||||
fn pointer_enter(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
@ -448,7 +448,7 @@ impl Node for XdgToplevel {
|
|||
renderer.render_xdg_surface(&self.xdg, x, y)
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
fn change_extents(self: &Rc<Self>, rect: &Rect) {
|
||||
let nw = rect.width();
|
||||
let nh = rect.height();
|
||||
let de = self.xdg.absolute_desired_extents.get();
|
||||
|
|
@ -460,11 +460,11 @@ impl Node for XdgToplevel {
|
|||
self.xdg.set_absolute_desired_extents(rect);
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
fn set_workspace(self: &Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
self.xdg.set_workspace(ws);
|
||||
}
|
||||
|
||||
fn set_parent(self: Rc<Self>, parent: Rc<dyn Node>) {
|
||||
fn set_parent(self: &Rc<Self>, parent: Rc<dyn Node>) {
|
||||
self.parent_node.set(Some(parent));
|
||||
self.notify_parent();
|
||||
}
|
||||
|
|
@ -501,7 +501,7 @@ impl ToplevelNode for XdgToplevel {
|
|||
|
||||
fn set_active(&self, active: bool) {
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
parent.child_active_changed(self, active);
|
||||
parent.node_child_active_changed(self, active);
|
||||
}
|
||||
let changed = {
|
||||
let mut states = self.states.borrow_mut();
|
||||
|
|
@ -526,11 +526,11 @@ impl ToplevelNode for XdgToplevel {
|
|||
Some(p) => p,
|
||||
_ => return,
|
||||
};
|
||||
if parent.is_float() {
|
||||
parent.remove_child(&*self);
|
||||
if parent.node_is_float() {
|
||||
parent.node_remove_child(&*self);
|
||||
self.map_tiled();
|
||||
} else if let Some(ws) = self.xdg.workspace.get() {
|
||||
parent.remove_child(&*self);
|
||||
parent.node_remove_child(&*self);
|
||||
self.map_floating(&ws);
|
||||
}
|
||||
}
|
||||
|
|
@ -550,7 +550,7 @@ impl XdgSurfaceExt for XdgToplevel {
|
|||
let surface = &self.xdg.surface;
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if surface.buffer.get().is_none() {
|
||||
parent.remove_child(&*self);
|
||||
parent.node_remove_child(&*self);
|
||||
{
|
||||
let new_parent = self.parent.get();
|
||||
let mut children = self.children.borrow_mut();
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ use {
|
|||
render::Renderer,
|
||||
state::State,
|
||||
tree::{
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
|
||||
WorkspaceNode,
|
||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, SizedNode, ToplevelData,
|
||||
ToplevelNode, WorkspaceNode,
|
||||
},
|
||||
utils::{
|
||||
clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode,
|
||||
|
|
@ -189,7 +189,7 @@ impl XwindowData {
|
|||
let title = self.info.title.borrow_mut();
|
||||
if let Some(w) = self.window.get() {
|
||||
if let Some(p) = w.parent_node.get() {
|
||||
p.child_title_changed(w.deref(), title.as_deref().unwrap_or(""));
|
||||
p.node_child_title_changed(w.deref(), title.as_deref().unwrap_or(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -227,7 +227,7 @@ impl Xwindow {
|
|||
}
|
||||
|
||||
pub fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.surface.set_toplevel(None);
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ impl Xwindow {
|
|||
let extents = self.surface.extents.get();
|
||||
// let extents = self.xdg.extents.get();
|
||||
// parent.child_active_changed(self, self.active_surfaces.get() > 0);
|
||||
parent.child_size_changed(self, extents.width(), extents.height());
|
||||
parent.node_child_size_changed(self, extents.width(), extents.height());
|
||||
// parent.child_title_changed(self, self.title.borrow_mut().deref());
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ impl Xwindow {
|
|||
let map_change = self.map_change();
|
||||
match map_change {
|
||||
Change::None => return,
|
||||
Change::Unmap => self.destroy_node(true),
|
||||
Change::Unmap => self.node_destroy(true),
|
||||
Change::Map if self.data.info.override_redirect.get() => {
|
||||
*self.display_link.borrow_mut() =
|
||||
Some(self.data.state.root.stacked.add_last(self.clone()));
|
||||
|
|
@ -293,8 +293,8 @@ impl Xwindow {
|
|||
}
|
||||
}
|
||||
match map_change {
|
||||
Change::Unmap => self.set_visible(false),
|
||||
Change::Map => self.set_visible(true),
|
||||
Change::Unmap => self.node_set_visible(false),
|
||||
Change::Map => self.node_set_visible(true),
|
||||
Change::None => {}
|
||||
}
|
||||
self.data.state.tree_changed();
|
||||
|
|
@ -307,7 +307,7 @@ impl SurfaceExt for Xwindow {
|
|||
}
|
||||
|
||||
fn on_surface_destroy(&self) -> Result<(), WlSurfaceError> {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.surface.unset_ext();
|
||||
self.data.window.set(None);
|
||||
self.data.surface_id.set(None);
|
||||
|
|
@ -321,24 +321,11 @@ impl SurfaceExt for Xwindow {
|
|||
}
|
||||
}
|
||||
|
||||
impl Node for Xwindow {
|
||||
impl SizedNode for Xwindow {
|
||||
fn id(&self) -> NodeId {
|
||||
self.id.into()
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.events.push(XWaylandEvent::Close(self.data.clone()));
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
self.surface.visible.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.surface.set_visible(visible);
|
||||
self.seat_state.set_visible(self, visible);
|
||||
}
|
||||
|
||||
fn seat_state(&self) -> &NodeSeatState {
|
||||
&self.seat_state
|
||||
}
|
||||
|
|
@ -349,36 +336,49 @@ impl Node for Xwindow {
|
|||
self.workspace.take();
|
||||
self.focus_history.clear();
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
parent.remove_child(self);
|
||||
parent.node_remove_child(self);
|
||||
}
|
||||
self.surface.destroy_node(false);
|
||||
self.surface.node_destroy(false);
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_xwindow(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_xwindow(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_surface(&self.surface);
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
self.surface.visible.get()
|
||||
}
|
||||
|
||||
fn set_visible(&self, visible: bool) {
|
||||
self.surface.node_set_visible(visible);
|
||||
self.seat_state.set_visible(self, visible);
|
||||
}
|
||||
|
||||
fn get_workspace(&self) -> Option<Rc<WorkspaceNode>> {
|
||||
self.workspace.get()
|
||||
}
|
||||
|
||||
fn is_contained_in(&self, other: NodeId) -> bool {
|
||||
if let Some(parent) = self.parent_node.get() {
|
||||
if parent.id() == other {
|
||||
if parent.node_id() == other {
|
||||
return true;
|
||||
}
|
||||
return parent.is_contained_in(other);
|
||||
return parent.node_is_contained_in(other);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self);
|
||||
fn do_focus(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
|
||||
seat.focus_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
self.events.push(XWaylandEvent::Close(self.data.clone()));
|
||||
}
|
||||
|
||||
fn absolute_position(&self) -> Rect {
|
||||
|
|
@ -399,8 +399,8 @@ impl Node for Xwindow {
|
|||
FindTreeResult::Other
|
||||
}
|
||||
|
||||
fn pointer_enter(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self);
|
||||
fn pointer_enter(self: &Rc<Self>, seat: &Rc<WlSeatGlobal>, _x: Fixed, _y: Fixed) {
|
||||
seat.enter_toplevel(self.clone());
|
||||
}
|
||||
|
||||
fn pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
@ -411,7 +411,7 @@ impl Node for Xwindow {
|
|||
renderer.render_surface(&self.surface, x, y)
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
fn change_extents(self: &Rc<Self>, rect: &Rect) {
|
||||
let old = self.data.info.extents.replace(*rect);
|
||||
if old != *rect {
|
||||
self.events.push(XWaylandEvent::Configure(self.clone()));
|
||||
|
|
@ -421,11 +421,11 @@ impl Node for Xwindow {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_workspace(self: Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
fn set_workspace(self: &Rc<Self>, ws: &Rc<WorkspaceNode>) {
|
||||
self.workspace.set(Some(ws.clone()));
|
||||
}
|
||||
|
||||
fn set_parent(self: Rc<Self>, parent: Rc<dyn Node>) {
|
||||
fn set_parent(self: &Rc<Self>, parent: Rc<dyn Node>) {
|
||||
self.parent_node.set(Some(parent));
|
||||
self.notify_parent();
|
||||
}
|
||||
|
|
@ -463,7 +463,7 @@ impl ToplevelNode for Xwindow {
|
|||
|
||||
fn set_active(&self, active: bool) {
|
||||
if let Some(pn) = self.parent_node.get() {
|
||||
pn.child_active_changed(self, active);
|
||||
pn.node_child_active_changed(self, active);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -476,11 +476,11 @@ impl ToplevelNode for Xwindow {
|
|||
Some(p) => p,
|
||||
_ => return,
|
||||
};
|
||||
if parent.is_float() {
|
||||
parent.remove_child(&*self);
|
||||
if parent.node_is_float() {
|
||||
parent.node_remove_child(&*self);
|
||||
self.data.state.map_tiled(self.clone());
|
||||
} else if let Some(ws) = self.workspace.get() {
|
||||
parent.remove_child(&*self);
|
||||
parent.node_remove_child(&*self);
|
||||
let extents = self.data.info.extents.get();
|
||||
self.data
|
||||
.state
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use {
|
|||
object::Object,
|
||||
rect::Rect,
|
||||
render::Renderer,
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode},
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode, SizedNode},
|
||||
utils::{
|
||||
bitflags::BitflagsExt,
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -45,6 +45,7 @@ pub struct ZwlrLayerSurfaceV1 {
|
|||
pub output: Rc<OutputNode>,
|
||||
pub namespace: String,
|
||||
pub tracker: Tracker<Self>,
|
||||
output_pos: Cell<Rect>,
|
||||
pos: Cell<Rect>,
|
||||
mapped: Cell<bool>,
|
||||
layer: Cell<u32>,
|
||||
|
|
@ -89,7 +90,8 @@ impl ZwlrLayerSurfaceV1 {
|
|||
output: output.clone(),
|
||||
namespace: namespace.to_string(),
|
||||
tracker: Default::default(),
|
||||
pos: Cell::new(Default::default()),
|
||||
output_pos: Default::default(),
|
||||
pos: Default::default(),
|
||||
mapped: Cell::new(false),
|
||||
layer: Cell::new(layer),
|
||||
pending: Default::default(),
|
||||
|
|
@ -196,7 +198,7 @@ impl ZwlrLayerSurfaceV1 {
|
|||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.client.remove_obj(self)?;
|
||||
self.surface.unset_ext();
|
||||
Ok(())
|
||||
|
|
@ -262,6 +264,10 @@ impl ZwlrLayerSurfaceV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn output_position(&self) -> Rect {
|
||||
self.output_pos.get()
|
||||
}
|
||||
|
||||
pub fn position(&self) -> Rect {
|
||||
self.pos.get()
|
||||
}
|
||||
|
|
@ -273,8 +279,8 @@ impl ZwlrLayerSurfaceV1 {
|
|||
anchor = LEFT | RIGHT | TOP | BOTTOM;
|
||||
}
|
||||
let opos = self.output.global.pos.get();
|
||||
let mut x1 = opos.x1();
|
||||
let mut y1 = opos.y1();
|
||||
let mut x1 = 0;
|
||||
let mut y1 = 0;
|
||||
if anchor.contains(LEFT) {
|
||||
if anchor.contains(RIGHT) {
|
||||
x1 += (opos.width() - width) / 2;
|
||||
|
|
@ -289,8 +295,9 @@ impl ZwlrLayerSurfaceV1 {
|
|||
} else if anchor.contains(BOTTOM) {
|
||||
y1 += opos.height() - height;
|
||||
}
|
||||
self.pos
|
||||
.set(Rect::new_sized(x1, y1, width, height).unwrap());
|
||||
let rect = Rect::new_sized(x1, y1, width, height).unwrap();
|
||||
self.output_pos.set(rect);
|
||||
self.pos.set(rect.move_(opos.x1(), opos.y1()));
|
||||
self.surface.set_absolute_position(x1, y1);
|
||||
self.client.state.tree_changed();
|
||||
}
|
||||
|
|
@ -306,7 +313,7 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
|||
let buffer = self.surface.buffer.get();
|
||||
if self.mapped.get() {
|
||||
if buffer.is_none() {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
} else {
|
||||
let pos = self.pos.get();
|
||||
let (width, height) = self.size.get();
|
||||
|
|
@ -326,7 +333,7 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
|||
let was_active = self.surface.seat_state.is_active();
|
||||
self.surface.seat_state.release_kb_focus();
|
||||
if was_active {
|
||||
self.surface.active_changed(false);
|
||||
self.surface.node_active_changed(false);
|
||||
}
|
||||
}
|
||||
KI_ON_DEMAND => self.surface.seat_state.release_kb_grab(),
|
||||
|
|
@ -346,7 +353,7 @@ impl SurfaceExt for ZwlrLayerSurfaceV1 {
|
|||
}
|
||||
}
|
||||
|
||||
impl Node for ZwlrLayerSurfaceV1 {
|
||||
impl SizedNode for ZwlrLayerSurfaceV1 {
|
||||
fn id(&self) -> NodeId {
|
||||
self.node_id.into()
|
||||
}
|
||||
|
|
@ -358,16 +365,16 @@ impl Node for ZwlrLayerSurfaceV1 {
|
|||
fn destroy_node(&self, _detach: bool) {
|
||||
self.link.set(None);
|
||||
self.mapped.set(false);
|
||||
self.surface.destroy_node(false);
|
||||
self.surface.node_destroy(false);
|
||||
self.seat_state.destroy_node(self);
|
||||
}
|
||||
|
||||
fn visit(self: Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_layer_surface(&self);
|
||||
fn visit(self: &Rc<Self>, visitor: &mut dyn NodeVisitor) {
|
||||
visitor.visit_layer_surface(self);
|
||||
}
|
||||
|
||||
fn visit_children(&self, visitor: &mut dyn NodeVisitor) {
|
||||
self.surface.clone().visit(visitor);
|
||||
self.surface.clone().node_visit(visitor);
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
|
|
@ -386,7 +393,7 @@ impl Node for ZwlrLayerSurfaceV1 {
|
|||
renderer.render_layer_surface(self, x, y);
|
||||
}
|
||||
|
||||
fn change_extents(self: Rc<Self>, _rect: &Rect) {
|
||||
fn change_extents(self: &Rc<Self>, _rect: &Rect) {
|
||||
self.compute_position();
|
||||
}
|
||||
}
|
||||
|
|
@ -415,7 +422,7 @@ impl Object for ZwlrLayerSurfaceV1 {
|
|||
}
|
||||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
self.node_destroy(true);
|
||||
self.link.set(None);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue