JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
refactored Sanders code somewhat
[dwm.git] / client.c
index 97dd96b..b1328d4 100644 (file)
--- a/client.c
+++ b/client.c
@@ -201,16 +201,17 @@ 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 = sx + (random() % diff ? diff : 1);
-       diff = sh - c->fh;
-       c->fy = sy + (random() % diff ? diff : 1);
+       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);
@@ -314,9 +315,9 @@ resize(Client *c, Bool inc, Corner sticky)
                *c->w = c->maxw;
        if(c->maxh && *c->h > c->maxh)
                *c->h = c->maxh;
-       if(sticky == TopRight || sticky == BottomRight)
+       if(sticky == TopRight || sticky == BotRight)
                *c->x = right - *c->w;
-       if(sticky == BottomLeft || sticky == BottomRight)
+       if(sticky == BotLeft || sticky == BotRight)
                *c->y = bottom - *c->h;
        resizetitle(c);
        XSetWindowBorderWidth(dpy, c->win, 1);