X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=09f3ae14adbd8179e616a4b514641684c070b67a;hb=53cac176928b67db4eb551295291ab09650927eb;hp=50bbd6a0f98f04ec3e7696fb87a30b7b2f428582;hpb=c1c6fdc5d8fef1247ac28e08ecc4d883095d1666;p=dwm.git diff --git a/dwm.c b/dwm.c index 50bbd6a..09f3ae1 100644 --- a/dwm.c +++ b/dwm.c @@ -272,8 +272,7 @@ applyrules(Client *c) { void arrange(void) { - if(stack) - showhide(stack); + showhide(stack); focus(NULL); if(lt[sellt]->arrange) lt[sellt]->arrange(); @@ -847,12 +846,14 @@ killclient(const Arg *arg) { void manage(Window w, XWindowAttributes *wa) { + static Client cz; Client *c, *t = NULL; Window trans = None; XWindowChanges wc; - if(!(c = calloc(1, sizeof(Client)))) - die("fatal: could not calloc() %u bytes\n", sizeof(Client)); + if(!(c = malloc(sizeof(Client)))) + die("fatal: could not malloc() %u bytes\n", sizeof(Client)); + *c = cz; c->win = w; /* geometry */ @@ -1369,15 +1370,18 @@ setup(void) { void showhide(Client *c) { + if(!c) + return; 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); + showhide(c->snext); } - if(c->snext) /* hide clients bottom up */ + else { /* hide clients bottom up */ showhide(c->snext); - if(!ISVISIBLE(c)) XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); + } } void @@ -1588,7 +1592,9 @@ updatesizehints(Client *c) { long msize; XSizeHints size; - XGetWMNormalHints(dpy, c->win, &size, &msize); + if(!XGetWMNormalHints(dpy, c->win, &size, &msize)) + /* size is uninitialized, ensure that size.flags aren't used */ + size.flags = PSize; if(size.flags & PBaseSize) { c->basew = size.base_width; c->baseh = size.base_height;