1
0
Fork 0
forked from wry/wry

autocommit 2022-01-03 18:56:52 CET

This commit is contained in:
Julian Orth 2022-01-03 18:56:52 +01:00
parent fc887b339e
commit 30376c595c
39 changed files with 3157 additions and 309 deletions

View file

@ -1,4 +1,5 @@
use crate::client::{Client, ClientError};
use crate::ifs::wl_display::WlDisplay;
use crate::ifs::wl_region::WlRegion;
use crate::ifs::wl_registry::WlRegistry;
use crate::ifs::wl_surface::WlSurface;
@ -8,12 +9,15 @@ use ahash::AHashMap;
use std::cell::{RefCell, RefMut};
use std::mem;
use std::rc::Rc;
use crate::ifs::xdg_wm_base::XdgWmBaseObj;
pub struct Objects {
pub display: RefCell<Option<Rc<WlDisplay>>>,
registry: CopyHashMap<ObjectId, Rc<dyn Object>>,
registries: CopyHashMap<ObjectId, Rc<WlRegistry>>,
pub surfaces: CopyHashMap<ObjectId, Rc<WlSurface>>,
pub regions: CopyHashMap<ObjectId, Rc<WlRegion>>,
pub xdg_wm_bases: CopyHashMap<ObjectId, Rc<XdgWmBaseObj>>,
ids: RefCell<Vec<usize>>,
}
@ -23,10 +27,12 @@ const SEG_SIZE: usize = 8 * mem::size_of::<usize>();
impl Objects {
pub fn new() -> Self {
Self {
display: RefCell::new(None),
registry: Default::default(),
registries: Default::default(),
surfaces: Default::default(),
regions: Default::default(),
xdg_wm_bases: Default::default(),
ids: RefCell::new(vec![]),
}
}
@ -38,6 +44,13 @@ impl Objects {
surface.break_loops();
}
}
{
let mut xdg_wm_bases = self.xdg_wm_bases.lock();
for xdg_wm_base in xdg_wm_bases.values_mut() {
xdg_wm_base.break_loops();
}
}
*self.display.borrow_mut() = None;
self.registry.clear();
self.regions.clear();
self.registries.clear();