summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorokan <okan>2014-02-02 21:34:05 +0000
committerokan <okan>2014-02-02 21:34:05 +0000
commitb923524a8e637141c0c832f6c8989ee600b67946 (patch)
treeb320db4f8e1b54cda2d7781fa617a6aaa27a9839 /client.c
parentc7d4add2f27b74f62be3dd973bca402eb89ee5cb (diff)
parentad76995af7e1bbae8ec81dd917def917453c379b (diff)
downloadcwm-b923524a8e637141c0c832f6c8989ee600b67946.tar.gz
cwm-b923524a8e637141c0c832f6c8989ee600b67946.tar.xz
cwm-b923524a8e637141c0c832f6c8989ee600b67946.zip
cvsimport
Diffstat (limited to 'client.c')
-rw-r--r--client.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/client.c b/client.c
index 456fe60..5d8444b 100644
--- a/client.c
+++ b/client.c
@@ -63,6 +63,10 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
 
 	if (win == None)
 		return (NULL);
+	if (!XGetWindowAttributes(X_Dpy, win, &wattr))
+		return (NULL);
+	if (sc == NULL)
+		sc = screen_fromroot(wattr.root);
 
 	cc = xcalloc(1, sizeof(*cc));
 
@@ -86,7 +90,6 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
 	cc->ptr.x = -1;
 	cc->ptr.y = -1;
 
-	XGetWindowAttributes(X_Dpy, cc->win, &wattr);
 	cc->geom.x = wattr.x;
 	cc->geom.y = wattr.y;
 	cc->geom.w = wattr.width;