summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorokan <okan>2014-02-03 21:07:47 +0000
committerokan <okan>2014-02-03 21:07:47 +0000
commit8653141b4b5d76bd7238003cf43034681c7724a4 (patch)
treebadc1a0d327780d82348bdb498db6d3e958267e8 /client.c
parentb923524a8e637141c0c832f6c8989ee600b67946 (diff)
parentf793964c9ec586b9c4b4843c14bc83afaf275cb4 (diff)
downloadcwm-8653141b4b5d76bd7238003cf43034681c7724a4.tar.gz
cwm-8653141b4b5d76bd7238003cf43034681c7724a4.tar.xz
cwm-8653141b4b5d76bd7238003cf43034681c7724a4.zip
cvsimport
Diffstat (limited to 'client.c')
-rw-r--r--client.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/client.c b/client.c
index 5d8444b..5005d49 100644
--- a/client.c
+++ b/client.c
@@ -55,18 +55,26 @@ client_find(Window win)
 }
 
 struct client_ctx *
-client_init(Window win, struct screen_ctx *sc, int mapped)
+client_init(Window win, struct screen_ctx *sc)
 {
 	struct client_ctx	*cc;
 	XWindowAttributes	 wattr;
 	long			 state;
+	int			 mapped;
 
 	if (win == None)
 		return (NULL);
 	if (!XGetWindowAttributes(X_Dpy, win, &wattr))
 		return (NULL);
-	if (sc == NULL)
+
+	if (sc == NULL) {
 		sc = screen_fromroot(wattr.root);
+		mapped = 1;
+	} else {
+		if (wattr.override_redirect || wattr.map_state != IsViewable)
+			return (NULL);
+		mapped = wattr.map_state != IsUnmapped;
+	}
 
 	cc = xcalloc(1, sizeof(*cc));