diff options
Diffstat (limited to 'src/clients/mod.rs')
-rw-r--r-- | src/clients/mod.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs index 823a501..76c30bb 100644 --- a/src/clients/mod.rs +++ b/src/clients/mod.rs @@ -10,7 +10,8 @@ use xcb::{ x::{ self, ChangeProperty, ConfigWindow, ConfigureNotifyEvent, ConfigureRequestEvent, ConfigureWindow, DeleteProperty, DestroyNotifyEvent, Drawable, EventMask, GetGeometry, - GetWindowAttributes, InputFocus, MapRequestEvent, SetInputFocus, UnmapNotifyEvent, Window, + GetWindowAttributes, InputFocus, MapRequestEvent, PropMode, SetInputFocus, + UnmapNotifyEvent, Window, }, xinerama::{self}, BaseEvent, Extension, @@ -257,16 +258,19 @@ impl ClientState { new.set_border(conn, conn.colours.border_focused()); new.set_urgent(false); if !new.never_focus() { - // XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); conn.send_request(&SetInputFocus { revert_to: InputFocus::PointerRoot, focus: new.window(), time: x::CURRENT_TIME, }); - // XChangeProperty(dpy, root, netatom[NetActiveWindow], - // XA_WINDOW, 32, PropModeReplace, - // (unsigned char *) &(c->win), 1); - // TODO: sendevent(c, wmatom[WMTakeFocus]); + conn.send_request(&ChangeProperty { + window: conn.root(), + mode: PropMode::Replace, + property: conn.atoms.net_active_window, + r#type: x::ATOM_WINDOW, + data: &[new.window()], + }); + conn.send_event(new.window(), conn.atoms.wm_take_focus); } } else { conn.send_request(&SetInputFocus { |