aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2014-02-02 21:34:05 +0000
committerokan2014-02-02 21:34:05 +0000
commitf21abfc55cc09949eb90c5fa93a629d04b204a6a (patch)
tree4fe82e798f855bbd1d066917a872a56547c9ddbc /client.c
parentb803e99634ca48acb240a6e5a67ab768a72159bc (diff)
downloadcwm-f21abfc55cc09949eb90c5fa93a629d04b204a6a.tar.gz
Move redundant window attr fetch from maprequest directly into
client_init and perform that X roundtrip only once.
Diffstat (limited to '')
-rw-r--r--client.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/client.c b/client.c
index ec053c3..23af4b2 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.169 2014/01/27 15:13:09 okan Exp $
+ * $OpenBSD: client.c,v 1.170 2014/02/02 21:34:05 okan Exp $
*/
#include <sys/param.h>
@@ -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;