diff options
author | tcmal <me@aria.rip> | 2024-08-06 14:39:55 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-13 17:56:36 +0100 |
commit | d973959f7f34e02eeb01766b01aff680639a8c4c (patch) | |
tree | 155aab05ad70915d0ebdf509e828765c0bac2822 /src/clients | |
parent | 89b5f3f87c8022f2d32c422c3516fca2f1538d69 (diff) |
Add support for mouse button binds
Diffstat (limited to 'src/clients')
-rw-r--r-- | src/clients/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs index 1abab20..a59240d 100644 --- a/src/clients/mod.rs +++ b/src/clients/mod.rs @@ -3,6 +3,7 @@ use std::cmp::{min, Ordering}; use crate::{ + buttons, config::BORDER_WIDTH, conn_info::Connection, debug, @@ -87,7 +88,7 @@ impl WM<'_> { /// Removing destroyed windows from the client list and rearrange. pub(crate) fn handle_destroy_notify(&mut self, e: &DestroyNotifyEvent) { - self.clients.unmanage(&self.conn, e.window()); + self.clients.unmanage_destroyed(&self.conn, e.window()); } /// Map a window, starting to manage it if needed. @@ -242,7 +243,7 @@ impl ClientState { | EventMask::STRUCTURE_NOTIFY, ); - // TODO: grabbuttons + buttons::grab(conn, c.window(), false); // Add to net_client_list conn.send_request(&ChangeProperty { @@ -258,8 +259,8 @@ impl ClientState { self.rearrange_monitor(conn, mon); } - /// Stop managing the given window - pub fn unmanage(&mut self, conn: &Connection<'_>, window: Window) { + /// Stop managing the given destroyed window + pub fn unmanage_destroyed(&mut self, conn: &Connection<'_>, window: Window) { let Some((mon, i)) = self.find_client_pos(window) else { return; }; @@ -275,6 +276,7 @@ impl ClientState { if let Some(new) = self.set_focused(mon, i) { new.set_border(conn, conn.colours.border_focused()); new.sync_hints(conn, true); + buttons::grab(conn, new.window(), true); if !new.never_focus() { conn.send_request(&SetInputFocus { revert_to: InputFocus::PointerRoot, @@ -307,6 +309,7 @@ impl ClientState { pub fn unfocus(&mut self, conn: &Connection<'_>) { if let Some(old) = self.focused_mut() { old.set_border(conn, conn.colours.border_normal()); + buttons::grab(conn, old.window(), false); } } |