diff options
author | tcmal <me@aria.rip> | 2024-06-27 00:13:33 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-06-27 00:13:33 +0100 |
commit | 112d094b9b2b549208d94af372a2526bfac009fd (patch) | |
tree | f42e6776dd6b40a1b5624129c416cc30afbfbc0e /src/clients | |
parent | bc641d4a0b5dde80c751feb9bf3403fefd2cbb50 (diff) |
send take focus event
Diffstat (limited to 'src/clients')
-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 { |