autocommit 2022-01-30 22:41:40 CET
This commit is contained in:
parent
f577f5feef
commit
865d5f295d
26 changed files with 1085 additions and 676 deletions
|
|
@ -352,6 +352,9 @@ impl Drop for ClientHolder {
|
|||
pub trait EventFormatter: Debug {
|
||||
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>);
|
||||
fn obj(&self) -> &dyn Object;
|
||||
fn should_log(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
pub type DynEventFormatter = Box<dyn EventFormatter>;
|
||||
|
|
@ -522,6 +525,9 @@ impl Client {
|
|||
}
|
||||
|
||||
pub fn log_event(&self, event: &dyn EventFormatter) {
|
||||
if !event.should_log() {
|
||||
return;
|
||||
}
|
||||
let obj = event.obj();
|
||||
log::trace!(
|
||||
"Client {} <= {}@{}.{:?}",
|
||||
|
|
@ -579,7 +585,6 @@ simple_add_obj!(WlShmObj);
|
|||
simple_add_obj!(WlShmPool);
|
||||
simple_add_obj!(WlSubcompositorObj);
|
||||
simple_add_obj!(WlSubsurface);
|
||||
simple_add_obj!(XdgToplevel);
|
||||
simple_add_obj!(XdgPopup);
|
||||
simple_add_obj!(WlOutputObj);
|
||||
simple_add_obj!(WlKeyboard);
|
||||
|
|
@ -615,3 +620,4 @@ dedicated_add_obj!(XdgSurface, xdg_surfaces);
|
|||
dedicated_add_obj!(WlBuffer, buffers);
|
||||
dedicated_add_obj!(WlSeatObj, seats);
|
||||
dedicated_add_obj!(XdgPositioner, xdg_positioners);
|
||||
dedicated_add_obj!(XdgToplevel, xdg_toplevel);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ use ahash::AHashMap;
|
|||
use std::cell::{RefCell, RefMut};
|
||||
use std::mem;
|
||||
use std::rc::Rc;
|
||||
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::{XdgToplevel, XdgToplevelId};
|
||||
use crate::tree::Node;
|
||||
|
||||
pub struct Objects {
|
||||
pub display: CloneCell<Option<Rc<WlDisplay>>>,
|
||||
|
|
@ -22,6 +24,7 @@ pub struct Objects {
|
|||
registries: CopyHashMap<WlRegistryId, Rc<WlRegistry>>,
|
||||
pub surfaces: CopyHashMap<WlSurfaceId, Rc<WlSurface>>,
|
||||
pub xdg_surfaces: CopyHashMap<XdgSurfaceId, Rc<XdgSurface>>,
|
||||
pub xdg_toplevel: CopyHashMap<XdgToplevelId, Rc<XdgToplevel>>,
|
||||
pub xdg_positioners: CopyHashMap<XdgPositionerId, Rc<XdgPositioner>>,
|
||||
pub regions: CopyHashMap<WlRegionId, Rc<WlRegion>>,
|
||||
pub buffers: CopyHashMap<WlBufferId, Rc<WlBuffer>>,
|
||||
|
|
@ -41,6 +44,7 @@ impl Objects {
|
|||
registries: Default::default(),
|
||||
surfaces: Default::default(),
|
||||
xdg_surfaces: Default::default(),
|
||||
xdg_toplevel: Default::default(),
|
||||
xdg_positioners: Default::default(),
|
||||
regions: Default::default(),
|
||||
buffers: Default::default(),
|
||||
|
|
@ -51,6 +55,13 @@ impl Objects {
|
|||
}
|
||||
|
||||
pub fn destroy(&self) {
|
||||
{
|
||||
let mut toplevel = self.xdg_toplevel.lock();
|
||||
for obj in toplevel.values_mut() {
|
||||
obj.destroy_node(true);
|
||||
}
|
||||
toplevel.clear();
|
||||
}
|
||||
{
|
||||
let mut registry = self.registry.lock();
|
||||
for obj in registry.values_mut() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue