changeset: 1317:fb2962745512 user: Matthias-Christian Ott date: Sun Jul 20 19:55:35 2008 +0200 summary: save floating dimensions diff -r df74a88a2d44 -r fb2962745512 dwm.c --- a/dwm.c Sun Jul 20 19:16:33 2008 +0200 +++ b/dwm.c Sun Jul 20 19:55:35 2008 +0200 @@ -85,6 +85,7 @@ struct Client { char name[256]; float mina, maxa; int x, y, w, h; + int sx, sy, sw, sh; int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; @@ -274,7 +275,9 @@ arrange(void) { for(c = clients; c; c = c->next) if(ISVISIBLE(c)) { XMoveWindow(dpy, c->win, c->x, c->y); - if(!lt[sellt]->arrange || c->isfloating) + if(!lt[sellt]->arrange && !c->isfloating) + resize(c, c->sx, c->sy, c->sw, c->sh, True); + else if (c->isfloating) resize(c, c->x, c->y, c->w, c->h, True); } else { @@ -912,6 +915,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->sx = c->x; + c->sy = c->y; + c->sw = c->w; + c->sh = c->h; XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, False); updatetitle(c); @@ -1117,6 +1124,12 @@ resize(Client *c, int x, int y, int w, i c->y = wc.y = y; c->w = wc.width = w; c->h = wc.height = h; + if (!lt[sellt]->arrange || c->isfloating) { + c->sx = x; + c->sy = y; + c->sw = w; + c->sh = h; + } wc.border_width = c->bw; XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); @@ -1480,7 +1493,13 @@ togglefloating(const Arg *arg) { return; sel->isfloating = !sel->isfloating || sel->isfixed; if(sel->isfloating) - resize(sel, sel->x, sel->y, sel->w, sel->h, True); + resize(sel, sel->sx, sel->sy, sel->sw, sel->sh, True); + else { + sel->sx = sel->x; + sel->sy = sel->y; + sel->sw = sel->w; + sel->sh = sel->h; + } arrange(); }