i3 - improved tiling WM


i3-input: restore the keyboard focus instead of the pointer focus

Patch status: rejected

Patch by Adrien Schildknecht

Long description:

When a window is focused using a bindsym, the pointer focus remain on
the previous windows, thus when i3-input is closed this windows will
be focused even if i3 draw the focused border on the other windows.

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

b/i3-input/main.c

17
@@ -90,7 +90,7 @@ static void restore_input_focus(void) {
18
         fprintf(stderr, "[i3-input] ERROR: Could not restore input focus (X error %d)\n", error->error_code);
19
         return;
20
     }
21
-    xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, reply->focus, XCB_CURRENT_TIME);
22
+    xcb_set_input_focus(conn, XCB_INPUT_FOCUS_FOLLOW_KEYBOARD, reply->focus, XCB_CURRENT_TIME);
23
     xcb_flush(conn);
24
 }
25
 
26
@@ -424,7 +424,7 @@ int main(int argc, char *argv[]) {
27
 
28
     /* Set input focus (we have override_redirect=1, so the wm will not do
29
      * this for us) */
30
-    xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, win, XCB_CURRENT_TIME);
31
+    xcb_set_input_focus(conn, XCB_INPUT_FOCUS_FOLLOW_KEYBOARD, win, XCB_CURRENT_TIME);
32
 
33
     /* Grab the keyboard to get all input */
34
     xcb_flush(conn);