X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=view.c;h=682e3317d2ac91f091089e4b27bbd04c57717035;hb=67986e81eed4a76cb4c50aed62ddb1fd14c4659d;hp=bb322350810141767841dcadb01df539be3ec42f;hpb=05c10c5776738fdfe73c1e66e14c869e2e5e338d;p=dwm.git diff --git a/view.c b/view.c index bb32235..682e331 100644 --- a/view.c +++ b/view.c @@ -18,6 +18,12 @@ minclient() { return min; } +static Client * +nexttiled(Client *c) { + for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); + return c; +} + static void reorder() { Client *c, *newclients, *tail; @@ -36,10 +42,24 @@ reorder() { clients = newclients; } -static Client * -nexttiled(Client *c) { - for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); - return c; +static void +togglemax(Client *c) +{ + XEvent ev; + if((c->ismax = !c->ismax)) { + c->rx = c->x; c->x = sx; + c->ry = c->y; c->y = bh; + c->rw = c->w; c->w = sw; + c->rh = c->h; c->h = sh - bh; + } + else { + c->x = c->rx; + c->y = c->ry; + c->w = c->rw; + c->h = c->rh; + } + resize(c, True, TopLeft); + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } /* extern */ @@ -82,8 +102,14 @@ dotile(Arg *arg) { w = sw - mw; for(n = 0, c = clients; c; c = c->next) - if(isvisible(c) && !c->isfloat) - n++; + if(isvisible(c)) { + if(c->isfloat) { + if(c->ismax) + togglemax(c); + } + else + n++; + } if(n > 1) h = (sh - bh) / (n - 1); @@ -206,7 +232,7 @@ void restack() { Client *c; XEvent ev; - + if(!sel) { drawstatus(); return; @@ -269,21 +295,14 @@ viewall(Arg *arg) { void zoom(Arg *arg) { - int tmp; unsigned int n; Client *c; - XEvent ev; if(!sel) return; if(sel->isfloat || (arrange == dofloat)) { - sel->x = sx; - sel->y = bh; - sel->w = sw; - sel->h = sh - bh; - resize(sel, True, TopLeft); - while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + togglemax(sel); return; }