about summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-11-01 14:07:19 +0000
committerokan <okan>2013-11-01 14:07:19 +0000
commitcaf8b315ab9eee9fccea8832278f4a449356315c (patch)
tree5ab7bf409d3ea9e915eb1c4d406619192dd38c50
parent0c99788f66ca591381601768c53ddf4ba203372a (diff)
parent06eb13dfd949199a730e9373529ef2a7e9f4b1e6 (diff)
downloadcwm-caf8b315ab9eee9fccea8832278f4a449356315c.tar.gz
cwm-caf8b315ab9eee9fccea8832278f4a449356315c.tar.xz
cwm-caf8b315ab9eee9fccea8832278f4a449356315c.zip
cvsimport
-rw-r--r--calmwm.h1
-rw-r--r--client.c25
2 files changed, 18 insertions, 8 deletions
diff --git a/calmwm.h b/calmwm.h
index ef9cdd3..707e2a2 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -177,6 +177,7 @@ struct client_ctx {
 #define CLIENT_FREEZE			0x0010
 #define CLIENT_GROUP			0x0020
 #define CLIENT_UNGROUP			0x0040
+#define CLIENT_INPUT			0x0080
 
 #define CLIENT_HIGHLIGHT		(CLIENT_GROUP | CLIENT_UNGROUP)
 #define CLIENT_MAXFLAGS			(CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED)
diff --git a/client.c b/client.c
index e22f4c9..75ef64a 100644
--- a/client.c
+++ b/client.c
@@ -99,17 +99,22 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
 	cc->geom.h = wattr.height;
 	cc->colormap = wattr.colormap;
 
+	if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) {
+		if (wmhints->flags & InputHint) {
+			if (wmhints->input == 1)
+				cc->flags |= CLIENT_INPUT;
+		}
+	}
 	if (wattr.map_state != IsViewable) {
 		client_placecalc(cc);
 		client_move(cc);
-		if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) {
-			if (wmhints->flags & StateHint) {
-				cc->state = wmhints->initial_state;
-				xu_set_wm_state(cc->win, cc->state);
-			}
-			XFree(wmhints);
+		if ((wmhints) && (wmhints->flags & StateHint)) {
+			cc->state = wmhints->initial_state;
+			xu_set_wm_state(cc->win, cc->state);
 		}
 	}
+	if (wmhints)
+		XFree(wmhints);
 	client_draw_border(cc);
 
 	if (xu_get_wm_state(cc->win, &state) < 0)
@@ -208,8 +213,12 @@ client_setactive(struct client_ctx *cc, int fg)
 
 	if (fg) {
 		XInstallColormap(X_Dpy, cc->colormap);
-		XSetInputFocus(X_Dpy, cc->win,
-		    RevertToPointerRoot, CurrentTime);
+		if (cc->flags & CLIENT_INPUT) {
+			XSetInputFocus(X_Dpy, cc->win,
+			    RevertToPointerRoot, CurrentTime);
+		}
+		if (cc->xproto & _WM_TAKE_FOCUS)
+			client_msg(cc, cwmh[WM_TAKE_FOCUS]);
 		conf_grab_mouse(cc->win);
 		/*
 		 * If we're in the middle of alt-tabbing, don't change