not really sure

This commit is contained in:
noonebtw 2021-01-13 19:49:39 +01:00
parent 2304968de7
commit 1ee395e708

View file

@ -3,6 +3,7 @@ use std::{
cell::{Cell, RefCell, RefMut},
collections::HashMap,
ffi::CString,
hash::{Hash, Hasher},
io::{Error, ErrorKind, Result},
ptr::{null, null_mut},
sync::Arc,
@ -76,6 +77,14 @@ pub struct Client {
window: Window,
}
impl PartialEq for Client {
fn eq(&self, other: &Self) -> bool {
self.window == other.window
}
}
impl Eq for Client {}
pub struct XLibState {
display: Display,
root: Window,
@ -352,9 +361,8 @@ impl WMState {
xlib::MapRequest => {
let event = unsafe { &event.map_request };
self.mut_state
.borrow_mut()
.clients
let _ = self.mut_state.try_borrow_mut().and_then(|mut_state| {
RefMut::map(mut_state, |t| &mut t.clients)
.entry(event.window)
.or_insert_with(|| {
unsafe { xlib::XMapWindow(self.dpy(), event.window) };
@ -362,6 +370,9 @@ impl WMState {
window: event.window,
})
});
Ok(())
});
}
xlib::UnmapNotify => {
let event = unsafe { &event.unmap };