Browse Source

applied Donald Chai's showhide patch in slightly modified ways

Anselm R Garbe 17 years ago
parent
commit
c1c6fdc5d8
1 changed files with 16 additions and 12 deletions
  1. 16 12
      dwm.c

+ 16 - 12
dwm.c

@@ -180,6 +180,7 @@ static void setclientstate(Client *c, long state);
 static void setlayout(const Arg *arg);
 static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
 static void setup(void);
+static void showhide(Client *c);
 static void spawn(const Arg *arg);
 static void spawn(const Arg *arg);
 static void tag(const Arg *arg);
 static void tag(const Arg *arg);
 static int textnw(const char *text, unsigned int len);
 static int textnw(const char *text, unsigned int len);
@@ -271,18 +272,8 @@ applyrules(Client *c) {
 
 
 void
 void
 arrange(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);
 	focus(NULL);
 	if(lt[sellt]->arrange)
 	if(lt[sellt]->arrange)
 		lt[sellt]->arrange();
 		lt[sellt]->arrange();
@@ -1376,6 +1367,19 @@ setup(void) {
 	grabkeys();
 	grabkeys();
 }
 }
 
 
+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
 void
 spawn(const Arg *arg) {
 spawn(const Arg *arg) {
 	/* The double-fork construct avoids zombie processes and keeps the code
 	/* The double-fork construct avoids zombie processes and keeps the code