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