summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authorokan <okan>2014-02-03 20:20:39 +0000
committerokan <okan>2014-02-03 20:20:39 +0000
commitad96c168386aced17e3fa4859dad1e1e2d80bb57 (patch)
treea559609931d906f63e721bc0c8b1901de7ee47bf /screen.c
parentad76995af7e1bbae8ec81dd917def917453c379b (diff)
downloadcwm-ad96c168386aced17e3fa4859dad1e1e2d80bb57.tar.gz
cwm-ad96c168386aced17e3fa4859dad1e1e2d80bb57.tar.xz
cwm-ad96c168386aced17e3fa4859dad1e1e2d80bb57.zip
Move redundant bits from screen_init (while dealing with existing
clients) directly into client_init, performing the X roundtrip only
once. With the previous change in maprequest, this moves decision making
into one place for creating new clients.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/screen.c b/screen.c
index df19c08..a9c051d 100644
--- a/screen.c
+++ b/screen.c
@@ -35,7 +35,6 @@ screen_init(int which)
 {
 	struct screen_ctx	*sc;
 	Window			*wins, w0, w1;
-	XWindowAttributes	 winattr;
 	XSetWindowAttributes	 rootattr;
 	unsigned int		 nwins, i;
 
@@ -62,17 +61,12 @@ screen_init(int which)
 	    CWEventMask|CWCursor, &rootattr);
 
 	/* Deal with existing clients. */
-	XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
-	for (i = 0; i < nwins; i++) {
-		XGetWindowAttributes(X_Dpy, wins[i], &winattr);
-		if (winattr.override_redirect ||
-		    winattr.map_state != IsViewable)
-			continue;
-		(void)client_init(wins[i], sc, winattr.map_state != IsUnmapped);
-	}
-	if (wins)
-		XFree(wins);
+	if (XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins)) {
+		for (i = 0; i < nwins; i++)
+			(void)client_init(wins[i], sc);
 
+		XFree(wins);
+	}
 	screen_updatestackingorder(sc);
 
 	if (HasRandr)