diff -u a/client.c b/client.c --- a/client.c 2007-08-23 17:11:41.000000000 +0100 +++ b/client.c 2007-08-26 00:41:29.000000000 +0100 @@ -186,10 +186,10 @@ c = emallocz(sizeof(Client)); c->tags = emallocz(ntags * sizeof(Bool)); c->win = w; - c->x = wa->x; - c->y = wa->y; - c->w = wa->width; - c->h = wa->height; + c->x = c->rx = wa->x; + c->y = c->ry = wa->y; + c->w = c->rw = wa->width; + c->h = c->rh = wa->height; c->oldborder = wa->border_width; if(c->w == sw && c->h == sh) { c->x = sx; @@ -198,13 +198,13 @@ } else { if(c->x + c->w + 2 * c->border > wax + waw) - c->x = wax + waw - c->w - 2 * c->border; + c->x = c->rx = wax + waw - c->w - 2 * c->border; if(c->y + c->h + 2 * c->border > way + wah) - c->y = way + wah - c->h - 2 * c->border; + c->y = c->ry = way + wah - c->h - 2 * c->border; if(c->x < wax) - c->x = wax; + c->x = c->rx = wax; if(c->y < way) - c->y = way; + c->y = c->ry = way; c->border = BORDERPX; } wc.border_width = c->border; diff -u a/dwm.h b/dwm.h --- a/dwm.h 2007-08-23 17:11:41.000000000 +0100 +++ b/dwm.h 2007-08-26 00:41:29.000000000 +0100 @@ -87,6 +87,7 @@ extern DC dc; /* global draw context */ extern Display *dpy; extern Window root, barwin; +extern Bool ltchange; /* client.c */ void attach(Client *c); /* attaches c to global client list */ diff -u a/screen.c b/screen.c --- a/screen.c 2007-08-23 17:11:41.000000000 +0100 +++ b/screen.c 2007-08-26 00:41:29.000000000 +0100 @@ -48,7 +48,7 @@ for(c = clients; c; c = c->next) if(isvisible(c)) - resize(c, c->x, c->y, c->w, c->h, True); + resize(c, c->rx, c->ry, c->rw, c->rh, True); } LAYOUTS @@ -56,6 +56,7 @@ /* extern */ unsigned int blw = 0; +Bool ltchange = False; void applyrules(Client *c) { @@ -243,6 +244,7 @@ if(!arg) { if(++ltidx == nlayouts) ltidx = 0;; + ltchange = True; } else { for(i = 0; i < nlayouts; i++) @@ -251,6 +253,7 @@ if(i == nlayouts) return; ltidx = i; + ltchange = True; } if(sel) arrange(); @@ -288,7 +291,14 @@ return; sel->isfloating = !sel->isfloating; if(sel->isfloating) - resize(sel, sel->x, sel->y, sel->w, sel->h, True); + resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True); + else { + sel->rx = sel->x; + sel->ry = sel->y; + sel->rw = sel->w; + sel->rh = sel->h; + } + arrange(); } diff -u a/tile.c b/tile.c --- a/tile.c 2007-08-23 17:11:41.000000000 +0100 +++ b/tile.c 2007-08-26 00:41:29.000000000 +0100 @@ -63,11 +63,18 @@ else nh = th - 2 * c->border; } + if (ltchange) { + c->rx = c->x; + c->ry = c->y; + c->rw = c->w; + c->rh = c->h; + } resize(c, nx, ny, nw, nh, False); if(n > 1 && th != wah) ny += nh + 2 * c->border; i++; } + ltchange = False; } void