$OpenBSD: patch-src_window_c,v 1.1 2012/01/20 15:53:18 dcoppa Exp $

Bugfix: respect WM_HINTS.input for WM_TAKE_FOCUS clients. This fixes
problems with some Qt apps
(upstream git commit 2d14ced024416e2074b57290bf7dade7d08899e5)

--- src/window.c.orig	Sat Dec 24 16:25:08 2011
+++ src/window.c	Fri Jan 20 14:29:55 2012
@@ -251,3 +251,28 @@ void window_update_role(i3Window *win, xcb_get_propert
 
     free(prop);
 }
+
+/*
+ * Updates the WM_HINTS (we only care about the input focus handling part).
+ *
+ */
+void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop) {
+    if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
+        DLOG("WM_HINTS not set.\n");
+        FREE(prop);
+        return;
+    }
+
+    xcb_icccm_wm_hints_t hints;
+
+    if (!xcb_icccm_get_wm_hints_from_reply(&hints, prop)) {
+        DLOG("Could not get WM_HINTS\n");
+        free(prop);
+        return;
+    }
+
+    win->doesnt_accept_focus = !hints.input;
+    LOG("WM_HINTS.input changed to \"%d\"\n", hints.input);
+
+    free(prop);
+}
