diff options
Diffstat (limited to 'src/clients.rs')
-rw-r--r-- | src/clients.rs | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/clients.rs b/src/clients.rs index f04fc36..2892c9d 100644 --- a/src/clients.rs +++ b/src/clients.rs @@ -3,9 +3,9 @@ use std::cmp::min; use crate::{config::BORDER_WIDTH, error::*, WM}; use xcb::{ x::{ - ChangeWindowAttributes, ConfigWindow, ConfigureNotifyEvent, ConfigureRequestEvent, - ConfigureWindow, Cw, DestroyNotifyEvent, Drawable, EventMask, GetGeometry, - GetWindowAttributes, MapRequestEvent, MapWindow, SendEvent, SendEventDest, + self, ChangeProperty, ChangeWindowAttributes, ConfigWindow, ConfigureNotifyEvent, + ConfigureRequestEvent, ConfigureWindow, Cw, DestroyNotifyEvent, Drawable, EventMask, + GetGeometry, GetWindowAttributes, MapRequestEvent, MapWindow, SendEvent, SendEventDest, UnmapNotifyEvent, UnmapWindow, Window, }, xinerama::{self, ScreenInfo}, @@ -138,7 +138,13 @@ impl WM<'_> { pub(crate) fn handle_unmap_notify(&mut self, e: UnmapNotifyEvent) -> Result<()> { if self.clients.find_client_mut(e.window()).is_some() { if e.is_from_send_event() { - // TODO: set client state to withdrawn + self.conn.send_request(&ChangeProperty { + mode: xcb::x::PropMode::Replace, + window: e.window(), + property: self.atoms.wm_state, + r#type: self.atoms.wm_state, + data: &[0_u8, 0_u8], + }); } else { self.clients.remove_client(e.window()); self.clients.rearrange(self.conn); @@ -205,13 +211,32 @@ impl WM<'_> { | EventMask::STRUCTURE_NOTIFY, ); // TODO: grabbuttons - // TODO: add to NetClientList - // TODO: XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ - // TODO: setclientstate(c, NormalState); + // set ewmh + self.conn.send_request(&ChangeProperty { + mode: xcb::x::PropMode::Append, + window: self.root, + property: self.atoms.net_client_list, + r#type: x::ATOM_WINDOW, + data: &[window], + }); + self.set_client_withdrawn(window, false); + + // TODO: XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ self.refocus(mon, 0); self.clients.rearrange_monitor(conn, mon); } + + /// Set the given window as withdrawn / not withdrawn. + fn set_client_withdrawn(&self, window: Window, withdrawn: bool) { + self.conn.send_request(&ChangeProperty { + mode: xcb::x::PropMode::Replace, + window, + property: self.atoms.wm_state, + r#type: self.atoms.wm_state, + data: &[!withdrawn as u8, 0_u8], + }); + } } /// Holds state related to the window manager's clients |