X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=50bbd6a0f98f04ec3e7696fb87a30b7b2f428582;hb=c1c6fdc5d8fef1247ac28e08ecc4d883095d1666;hp=4ed5760f4bb75946adc3822817e3ab6a70a11c46;hpb=30410108eb7e9e8b977d448f611659d58b2a6992;p=dwm.git diff --git a/dwm.c b/dwm.c index 4ed5760..50bbd6a 100644 --- a/dwm.c +++ b/dwm.c @@ -180,6 +180,7 @@ static void setclientstate(Client *c, long state); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); +static void showhide(Client *c); static void spawn(const Arg *arg); static void tag(const Arg *arg); static int textnw(const char *text, unsigned int len); @@ -271,18 +272,8 @@ applyrules(Client *c) { void arrange(void) { - Client *c; - - for(c = clients; c; c = c->next) - if(ISVISIBLE(c)) { - XMoveWindow(dpy, c->win, c->x, c->y); - if(!lt[sellt]->arrange || c->isfloating) - resize(c, c->x, c->y, c->w, c->h, True); - } - else { - XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); - } - + if(stack) + showhide(stack); focus(NULL); if(lt[sellt]->arrange) lt[sellt]->arrange(); @@ -337,15 +328,14 @@ buttonpress(XEvent *e) { void checkotherwm(void) { otherwm = False; - XSetErrorHandler(xerrorstart); + xerrorxlib = XSetErrorHandler(xerrorstart); /* this causes an error if some other window manager is running */ XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask); XSync(dpy, False); if(otherwm) die("dwm: another window manager is already running\n"); - XSetErrorHandler(NULL); - xerrorxlib = XSetErrorHandler(xerror); + XSetErrorHandler(xerror); XSync(dpy, False); } @@ -1378,6 +1368,19 @@ setup(void) { } void +showhide(Client *c) { + if(ISVISIBLE(c)) { /* show clients top down */ + XMoveWindow(dpy, c->win, c->x, c->y); + if(!lt[sellt]->arrange || c->isfloating) + resize(c, c->x, c->y, c->w, c->h, True); + } + if(c->snext) /* hide clients bottom up */ + showhide(c->snext); + if(!ISVISIBLE(c)) + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); +} + +void spawn(const Arg *arg) { /* The double-fork construct avoids zombie processes and keeps the code * clean from stupid signal handlers. */ @@ -1625,7 +1628,7 @@ updatesizehints(Client *c) { else c->maxa = c->mina = 0.0; c->isfixed = (c->maxw && c->minw && c->maxh && c->minh - && c->maxw == c->minw && c->maxh == c->minh); + && c->maxw == c->minw && c->maxh == c->minh); } void