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
commitad76995af7e1bbae8ec81dd917def917453c379b (patch)
tree93db5a1feb568457317fc895aabc0635c2d7be53 /client.c
parentad1b78c6d1b466fbc2c11eec92ad5ce75bb44515 (diff)
downloadcwm-ad76995af7e1bbae8ec81dd917def917453c379b.tar.gz
cwm-ad76995af7e1bbae8ec81dd917def917453c379b.tar.xz
cwm-ad76995af7e1bbae8ec81dd917def917453c379b.zip
Move redundant window attr fetch from maprequest directly into
client_init and perform that X roundtrip only once.
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 22ee927..632f3f3 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;