diff options
author | okan <okan> | 2014-02-02 21:34:05 +0000 |
---|---|---|
committer | okan <okan> | 2014-02-02 21:34:05 +0000 |
commit | ad76995af7e1bbae8ec81dd917def917453c379b (patch) | |
tree | 93db5a1feb568457317fc895aabc0635c2d7be53 | |
parent | ad1b78c6d1b466fbc2c11eec92ad5ce75bb44515 (diff) | |
download | cwm-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.
-rw-r--r-- | client.c | 5 | ||||
-rw-r--r-- | xevents.c | 9 |
2 files changed, 7 insertions, 7 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; diff --git a/xevents.c b/xevents.c index 89d7a63..06551e8 100644 --- a/xevents.c +++ b/xevents.c @@ -75,17 +75,14 @@ xev_handle_maprequest(XEvent *ee) { XMapRequestEvent *e = &ee->xmaprequest; struct client_ctx *cc = NULL, *old_cc; - XWindowAttributes xattr; if ((old_cc = client_current())) client_ptrsave(old_cc); - if ((cc = client_find(e->window)) == NULL) { - XGetWindowAttributes(X_Dpy, e->window, &xattr); - cc = client_init(e->window, screen_fromroot(xattr.root), 1); - } + if ((cc = client_find(e->window)) == NULL) + cc = client_init(e->window, NULL, 1); - if ((cc->flags & CLIENT_IGNORE) == 0) + if ((cc != NULL) && ((cc->flags & CLIENT_IGNORE) == 0)) client_ptrwarp(cc); } |