diff -r ce55dc65c72a dwm.c --- a/dwm.c Sat Sep 22 23:20:23 2007 +0200 +++ b/dwm.c Sat Sep 22 23:26:59 2007 +0200 @@ -60,6 +60,7 @@ struct Client { char name[256]; int x, y, w, h; int rx, ry, rw, rh; /* revert geometry */ + int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */ int basew, baseh, incw, inch, maxw, maxh, minw, minh; int minax, maxax, minay, maxay; long flags; @@ -728,7 +729,13 @@ floating(void) { /* default floating lay for(c = clients; c; c = c->next) if(isvisible(c)) - resize(c, c->x, c->y, c->w, c->h, True); + { + if(!c->isfloating) + /*restore last known float dimensions*/ + resize(c, c->sfx, c->sfy, c->sfw, c->sfh, True); + else + resize(c, c->x, c->y, c->w, c->h, True); + } } void @@ -1082,6 +1089,10 @@ manage(Window w, XWindowAttributes *wa) XSetWindowBorder(dpy, w, dc.norm[ColBorder]); configure(c); /* propagates border_width, if size doesn't change */ updatesizehints(c); + c->sfx = c->x; + c->sfy = c->y; + c->sfw = c->w; + c->sfh = c->h; XSelectInput(dpy, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask); grabbuttons(c, False); @@ -1722,7 +1733,15 @@ togglefloating(const char *arg) { return; sel->isfloating = !sel->isfloating; if(sel->isfloating) - resize(sel, sel->x, sel->y, sel->w, sel->h, True); + /*restore last known float dimensions*/ + resize(sel, sel->sfx, sel->sfy, sel->sfw, sel->sfh, True); + else { + /*save last known float dimensions*/ + sel->sfx = sel->x; + sel->sfy = sel->y; + sel->sfw = sel->w; + sel->sfh = sel->h; + } arrange(); }