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
|
|
@ -1,6 +1,7 @@
|
|||
use crate::cursor::Cursor;
|
||||
use crate::ifs::wl_seat::WlSeatGlobal;
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
use std::cell::Cell;
|
||||
|
|
@ -12,6 +13,7 @@ pub struct CursorSurface {
|
|||
hotspot: Cell<(i32, i32)>,
|
||||
pos: Cell<(i32, i32)>,
|
||||
extents: Cell<Rect>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl CursorSurface {
|
||||
|
|
@ -22,6 +24,7 @@ impl CursorSurface {
|
|||
hotspot: Cell::new((0, 0)),
|
||||
pos: Cell::new((0, 0)),
|
||||
extents: Cell::new(Default::default()),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use crate::ifs::wl_surface::{
|
|||
CommitAction, CommitContext, StackElement, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
|
||||
WlSurfaceId,
|
||||
};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
|
|
@ -31,6 +32,7 @@ pub struct WlSubsurface {
|
|||
node: RefCell<Option<LinkedNode<StackElement>>>,
|
||||
depth: NumCell<u32>,
|
||||
pending: PendingSubsurfaceData,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -85,6 +87,7 @@ impl WlSubsurface {
|
|||
node: RefCell::new(None),
|
||||
depth: NumCell::new(0),
|
||||
pending: Default::default(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use crate::ifs::wl_surface::{
|
|||
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
|
||||
};
|
||||
use crate::ifs::xdg_wm_base::XdgWmBase;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::tree::{FindTreeResult, FoundNode, Node, WorkspaceNode};
|
||||
|
|
@ -22,6 +23,7 @@ use crate::wire::xdg_surface::*;
|
|||
use crate::wire::{WlSurfaceId, XdgPopupId, XdgSurfaceId};
|
||||
use crate::NumCell;
|
||||
use std::cell::Cell;
|
||||
use std::fmt::Debug;
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -64,14 +66,15 @@ pub struct XdgSurface {
|
|||
pub(super) focus_surface: SmallMap<SeatId, Rc<WlSurface>, 1>,
|
||||
seat_state: NodeSeatState,
|
||||
pub workspace: CloneCell<Option<Rc<WorkspaceNode>>>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Debug)]
|
||||
struct PendingXdgSurfaceData {
|
||||
geometry: Cell<Option<Rect>>,
|
||||
}
|
||||
|
||||
trait XdgSurfaceExt {
|
||||
pub trait XdgSurfaceExt: Debug {
|
||||
fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -111,6 +114,7 @@ impl XdgSurface {
|
|||
focus_surface: Default::default(),
|
||||
seat_state: Default::default(),
|
||||
workspace: Default::default(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,6 +218,7 @@ impl XdgSurface {
|
|||
return Err(DestroyError::PopupsNotYetDestroyed);
|
||||
}
|
||||
}
|
||||
self.focus_surface.clear();
|
||||
self.surface.set_xdg_surface(None);
|
||||
self.surface.unset_ext();
|
||||
self.base.surfaces.remove(&self.id);
|
||||
|
|
@ -236,6 +241,7 @@ impl XdgSurface {
|
|||
return Err(GetToplevelError::AlreadyConstructed);
|
||||
}
|
||||
let toplevel = Rc::new(XdgToplevel::new(req.id, self));
|
||||
track!(self.surface.client, toplevel);
|
||||
self.surface.client.add_client_obj(&toplevel)?;
|
||||
self.ext.set(Some(toplevel));
|
||||
Ok(())
|
||||
|
|
@ -261,6 +267,7 @@ impl XdgSurface {
|
|||
return Err(GetPopupError::AlreadyConstructed);
|
||||
}
|
||||
let popup = Rc::new(XdgPopup::new(req.id, self, parent.as_ref(), &positioner)?);
|
||||
track!(self.surface.client, popup);
|
||||
self.surface.client.add_client_obj(&popup)?;
|
||||
if let Some(parent) = &parent {
|
||||
parent.popups.set(req.id, popup.clone());
|
||||
|
|
@ -341,6 +348,9 @@ impl Object for XdgSurface {
|
|||
|
||||
fn break_loops(&self) {
|
||||
self.focus_surface.take();
|
||||
self.ext.take();
|
||||
self.popups.clear();
|
||||
self.workspace.set(None);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use crate::fixed::Fixed;
|
|||
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
|
||||
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
|
||||
use crate::ifs::xdg_positioner::{XdgPositioned, XdgPositioner, CA};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
|
|
@ -15,6 +16,7 @@ use crate::utils::linkedlist::LinkedNode;
|
|||
use crate::wire::xdg_popup::*;
|
||||
use crate::wire::XdgPopupId;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -32,6 +34,13 @@ pub struct XdgPopup {
|
|||
display_link: RefCell<Option<LinkedNode<Rc<dyn Node>>>>,
|
||||
workspace_link: RefCell<Option<LinkedNode<Rc<dyn Node>>>>,
|
||||
pos: RefCell<XdgPositioned>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl Debug for XdgPopup {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("XdgPopup").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl XdgPopup {
|
||||
|
|
@ -54,6 +63,7 @@ impl XdgPopup {
|
|||
display_link: RefCell::new(None),
|
||||
workspace_link: RefCell::new(None),
|
||||
pos: RefCell::new(pos),
|
||||
tracker: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use crate::cursor::KnownCursor;
|
|||
use crate::fixed::Fixed;
|
||||
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
|
||||
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
|
|
@ -21,7 +22,9 @@ use crate::{bugs, NumCell};
|
|||
use ahash::{AHashMap, AHashSet};
|
||||
use num_derive::FromPrimitive;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -78,6 +81,13 @@ pub struct XdgToplevel {
|
|||
min_height: Cell<Option<i32>>,
|
||||
max_width: Cell<Option<i32>>,
|
||||
max_height: Cell<Option<i32>>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl Debug for XdgToplevel {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("XdgToplevel").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl XdgToplevel {
|
||||
|
|
@ -103,6 +113,7 @@ impl XdgToplevel {
|
|||
min_height: Cell::new(None),
|
||||
max_width: Cell::new(None),
|
||||
max_height: Cell::new(None),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -158,19 +169,30 @@ impl XdgToplevel {
|
|||
})
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.xdg.surface.client.parse(self, parser)?;
|
||||
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.xdg.ext.set(None);
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
parent.remove_child(self);
|
||||
}
|
||||
{
|
||||
let mut children = self.children.borrow_mut();
|
||||
let parent = self.parent.get();
|
||||
let mut parent_children = match &parent {
|
||||
Some(p) => Some(p.children.borrow_mut()),
|
||||
_ => None,
|
||||
};
|
||||
for (_, child) in children.drain() {
|
||||
child.parent.set(self.parent.get());
|
||||
child.parent.set(parent.clone());
|
||||
if let Some(parent_children) = &mut parent_children {
|
||||
parent_children.insert(child.id, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
if let Some(parent) = self.parent.take() {
|
||||
parent.children.borrow_mut().remove(&self.id);
|
||||
}
|
||||
}
|
||||
self.xdg.surface.client.remove_obj(self.deref())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -388,9 +410,6 @@ impl Object for XdgToplevel {
|
|||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
parent.remove_child(self);
|
||||
}
|
||||
self.parent.set(None);
|
||||
let _children = mem::take(&mut *self.children.borrow_mut());
|
||||
}
|
||||
|
|
@ -411,6 +430,7 @@ impl Node for XdgToplevel {
|
|||
if let Some(parent) = self.parent_node.take() {
|
||||
if detach {
|
||||
parent.remove_child(self);
|
||||
self.xdg.surface.client.state.tree_changed();
|
||||
}
|
||||
}
|
||||
self.toplevel_history.take();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue