X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=92668921839101ff7a14893cbf1297e9dec4895c;hb=7df39f3fc71aa62e64664787902152b41617fe1c;hp=43dcdc0973b430722c6211c6da4d32ca2b135d18;hpb=565697087b92db6eb09e896f60f68503ce0a4ac1;p=dwm.git diff --git a/dwm.c b/dwm.c index 43dcdc0..9266892 100644 --- a/dwm.c +++ b/dwm.c @@ -179,7 +179,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, unsigned int ntiled); +static void showhide(Client *c); static void sigchld(int signal); static void spawn(const Arg *arg); static void tag(const Arg *arg); @@ -338,11 +338,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h) { void arrange(void) { - unsigned int nt; - Client *c; - - for(nt = 0, c = nexttiled(clients); c; c = nexttiled(c->next), nt++); - showhide(stack, nt); + showhide(stack); focus(NULL); if(lt[sellt]->arrange) lt[sellt]->arrange(); @@ -801,7 +797,10 @@ grabbuttons(Client *c, Bool focused) { for(i = 0; i < LENGTH(buttons); i++) if(buttons[i].click == ClkClientWin) for(j = 0; j < LENGTH(modifiers); j++) - XGrabButton(dpy, buttons[i].button, buttons[i].mask | modifiers[j], c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); + XGrabButton(dpy, buttons[i].button, + buttons[i].mask | modifiers[j], + c->win, False, BUTTONMASK, + GrabModeAsync, GrabModeSync, None, None); } else XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); @@ -940,7 +939,8 @@ manage(Window w, XWindowAttributes *wa) { c->y = sy + sh - HEIGHT(c); c->x = MAX(c->x, sx); /* only fix client y-offset, if the client center might cover the bar */ - c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) && (c->x + (c->w / 2) < wx + ww)) ? bh : sy); + c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) + && (c->x + (c->w / 2) < wx + ww)) ? bh : sy); c->bw = borderpx; } @@ -1039,7 +1039,8 @@ movemouse(const Arg *arg) { ny = wy; else if(abs((wy + wh) - (ny + HEIGHT(c))) < snap) ny = wy + wh - HEIGHT(c); - if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) + if(!c->isfloating && lt[sellt]->arrange + && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) togglefloating(NULL); } if(!lt[sellt]->arrange || c->isfloating) @@ -1330,17 +1331,17 @@ setup(void) { } void -showhide(Client *c, unsigned int ntiled) { +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); - showhide(c->snext, ntiled); + showhide(c->snext); } else { /* hide clients bottom up */ - showhide(c->snext, ntiled); + showhide(c->snext); XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); } } @@ -1544,7 +1545,8 @@ updatenumlockmask(void) { modmap = XGetModifierMapping(dpy); for(i = 0; i < 8; i++) for(j = 0; j < modmap->max_keypermod; j++) - if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) + if(modmap->modifiermap[i * modmap->max_keypermod + j] + == XKeysymToKeycode(dpy, XK_Num_Lock)) numlockmask = (1 << i); XFreeModifiermap(modmap); }