JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
implemented fallback for too many clients in stacked mode
[dwm.git] / client.c
index af2c249..52e623a 100644 (file)
--- a/client.c
+++ b/client.c
@@ -192,6 +192,7 @@ lower(Client *c)
 void
 manage(Window w, XWindowAttributes *wa)
 {
+       int diff;
        Client *c;
        XSetWindowAttributes twa;
        Window trans;
@@ -200,11 +201,18 @@ manage(Window w, XWindowAttributes *wa)
        c->win = w;
        c->bx = c->fx = c->tx = wa->x;
        c->by = c->fy = c->ty = wa->y;
-       if(c->fy < bh)
-               c->by = c->fy = c->ty += bh;
        c->bw = c->fw = c->tw = wa->width;
        c->fh = c->th = wa->height;
        c->bh = bh;
+
+       diff = sw - c->fw;
+       c->fx = random() % (diff ? diff : 1);
+       diff = sh - c->fh - bh;
+       c->fy = random() % (diff ? diff : 1);
+
+       if(c->fy < bh)
+               c->by = c->fy = c->ty = bh;
+
        c->border = 1;
        c->proto = getproto(c->win);
        setsize(c);