about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-09-06 09:21:32 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-09-06 09:21:32 +0100
commitc1c6fdc5d8fef1247ac28e08ecc4d883095d1666 (patch)
treebb867fd15e35a7050a55f42e15c748188f296744
parent9a4d07d9de31c7bf3fba83c66d1a09d63848adfc (diff)
downloaddwm-c1c6fdc5d8fef1247ac28e08ecc4d883095d1666.tar.gz
applied Donald Chai's showhide patch in slightly modified ways
-rw-r--r--dwm.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/dwm.c b/dwm.c
index e7804dc..50bbd6a 100644
--- a/dwm.c
+++ b/dwm.c
@@ -180,6 +180,7 @@ static void setclientstate(Client *c, long state);
 static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
+static void showhide(Client *c);
 static void spawn(const Arg *arg);
 static void tag(const Arg *arg);
 static int textnw(const char *text, unsigned int len);
@@ -271,18 +272,8 @@ applyrules(Client *c) {
 
 void
 arrange(void) {
-	Client *c;
-
-	for(c = clients; c; c = c->next)
-		if(ISVISIBLE(c)) {
-			XMoveWindow(dpy, c->win, c->x, c->y);
-			if(!lt[sellt]->arrange || c->isfloating)
-				resize(c, c->x, c->y, c->w, c->h, True);
-		}
-		else {
-			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
-		}
-
+	if(stack)
+		showhide(stack);
 	focus(NULL);
 	if(lt[sellt]->arrange)
 		lt[sellt]->arrange();
@@ -1377,6 +1368,19 @@ setup(void) {
 }
 
 void
+showhide(Client *c) {
+	if(ISVISIBLE(c)) { /* show clients top down */
+		XMoveWindow(dpy, c->win, c->x, c->y);
+		if(!lt[sellt]->arrange || c->isfloating)
+			resize(c, c->x, c->y, c->w, c->h, True);
+	}
+	if(c->snext) /* hide clients bottom up */
+		showhide(c->snext);
+	if(!ISVISIBLE(c))
+		XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+}
+
+void
 spawn(const Arg *arg) {
 	/* The double-fork construct avoids zombie processes and keeps the code
 	 * clean from stupid signal handlers. */