i3 - improved tiling WM


Do not send WM_TAKE_FOCUS when InputHint is set

Patch status: needinfo

Patch by Tony Crisci

Long description:

Window managers do not conventionally send WM_TAKE_FOCUS when the
WM_HINTS property of the client has the `input` flag set (which shall be
"the client's input model").

The "models of input handling" can be found here:
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

fixes #1167

To apply this patch, use:
curl http://cr.i3wm.org/patch/402/raw.patch | git am

b/src/x.c

21
@@ -949,17 +949,13 @@ void x_push_changes(Con *con) {
22
             /* Invalidate focused_id to correctly focus new windows with the same ID */
23
             focused_id = XCB_NONE;
24
         } else {
25
-            bool set_focus = true;
26
             if (focused->window != NULL &&
27
-                focused->window->needs_take_focus) {
28
+                focused->window->needs_take_focus &&
29
+                focused->window->doesnt_accept_focus) {
30
                 DLOG("Updating focus by sending WM_TAKE_FOCUS to window 0x%08x (focused: %p / %s)\n",
31
                      to_focus, focused, focused->name);
32
                 send_take_focus(to_focus);
33
-                set_focus = !focused->window->doesnt_accept_focus;
34
-                DLOG("set_focus = %d\n", set_focus);
35
-            }
36
-
37
-            if (set_focus) {
38
+            } else {
39
                 DLOG("Updating focus (focused: %p / %s) to X11 window 0x%08x\n", focused, focused->name, to_focus);
40
                 /* We remove XCB_EVENT_MASK_FOCUS_CHANGE from the event mask to get
41
                  * no focus change events for our own focus changes. We only want