Set EWMH active window to None when none has focus
Patch status: needinfo
Patch by Tony Crisci
Long description:
_NET_ACTIVE_WINDOW: > The window ID of the currently active window or None if no window has > the focus. This fixes a bug that would not update _NET_ACTIVE_WINDOW when focus changed to an i3 container without a window such as a branch or workspace content container.
To apply this patch, use:
curl http://cr.i3wm.org/patch/561/raw.patch | git am
b/src/x.c
21 |
@@ -1013,6 +1013,8 @@ void x_push_changes(Con *con) { |
22 |
to_focus, focused, focused->name); |
23 |
send_take_focus(to_focus, last_timestamp); |
24 |
|
25 |
+ ewmh_update_active_window((con_has_managed_window(focused) ? focused->window->id : XCB_WINDOW_NONE)); |
26 |
+ |
27 |
if (to_focus != last_focused && is_con_attached(focused)) |
28 |
ipc_send_window_event("focus", focused); |
29 |
} else { |
30 |
@@ -1030,7 +1032,7 @@ void x_push_changes(Con *con) { |
31 |
xcb_change_window_attributes(conn, focused->window->id, XCB_CW_EVENT_MASK, values); |
32 |
} |
33 |
|
34 |
- ewmh_update_active_window(to_focus); |
35 |
+ ewmh_update_active_window((con_has_managed_window(focused) ? focused->window->id : XCB_WINDOW_NONE)); |
36 |
|
37 |
if (to_focus != XCB_NONE && to_focus != last_focused && focused->window != NULL && is_con_attached(focused)) |
38 |
ipc_send_window_event("focus", focused); |
39 |
@@ -1043,6 +1045,7 @@ void x_push_changes(Con *con) { |
40 |
if (focused_id == XCB_NONE) { |
41 |
DLOG("Still no window focused, better set focus to the root window\n"); |
42 |
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME); |
43 |
+ ewmh_update_active_window(XCB_WINDOW_NONE); |
44 |
focused_id = root; |
45 |
} |
46 |
|