summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2014-02-02 21:34:06 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2014-02-02 21:34:06 +0000
commita19c20895ddea33a894970b82e26255ffe571217 (patch)
tree0bf541be59a2363ba07ac242b096fdc1f54c5212
parent961e46b8e6a545e6bcfab524b33b4e5486b1daf9 (diff)
Move redundant window attr fetch from maprequest directly into
client_init and perform that X roundtrip only once.
-rw-r--r--app/cwm/client.c7
-rw-r--r--app/cwm/xevents.c11
2 files changed, 9 insertions, 9 deletions
diff --git a/app/cwm/client.c b/app/cwm/client.c
index ec053c342..23af4b2db 100644
--- a/app/cwm/client.c
+++ b/app/cwm/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;
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c
index f2b520f88..82dfeddd5 100644
--- a/app/cwm/xevents.c
+++ b/app/cwm/xevents.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: xevents.c,v 1.109 2014/01/30 15:41:11 okan Exp $
+ * $OpenBSD: xevents.c,v 1.110 2014/02/02 21:34:05 okan Exp $
*/
/*
@@ -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);
}