all repos — dwm @ c05962512840e181356750fd2061f8430d7193ed

my dwm build

applied Ph's seltags-simplification with some modifications
anselm@anselm1 unknown
Sun, 20 Apr 2008 18:35:11 +0100
commit

c05962512840e181356750fd2061f8430d7193ed

parent

874837f653433315bd2733823a0a1efe6f76b373

1 files changed, 10 insertions(+), 13 deletions(-)

jump to
M dwm.cdwm.c

@@ -214,6 +214,7 @@ char stext[256], buf[256];

int screen, sx, sy, sw, sh; int (*xerrorxlib)(Display *, XErrorEvent *); int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; +int viewtags_set = 0; double mfact; unsigned int numlockmask = 0; void (*handler[LASTEvent]) (XEvent *) = {

@@ -233,8 +234,8 @@ };

Atom wmatom[WMLast], netatom[NetLast]; Bool otherwm, readin; Bool running = True; -Bool *prevtags; Bool *seltags; +Bool *viewtags[2]; Client *clients = NULL; Client *sel = NULL; Client *stack = NULL;

@@ -246,7 +247,6 @@

/* configuration, allows nested code to access above variables */ #include "config.h" #define TAGSZ (LENGTH(tags) * sizeof(Bool)) -Bool tmp[LENGTH(tags)]; Layout *lt = layouts; Geom *geom = geoms;

@@ -1158,11 +1158,10 @@ }

void reapply(const char *arg) { - static Bool zerotags[LENGTH(tags)] = { 0 }; Client *c; for(c = clients; c; c = c->next) { - memcpy(c->tags, zerotags, sizeof zerotags); + memset(c->tags, 0, TAGSZ); applyrules(c); } arrange();

@@ -1506,9 +1505,10 @@ if(!dc.font.set)

XSetFont(dpy, dc.gc, dc.font.xfont->fid); /* init tags */ - seltags = emallocz(TAGSZ); - prevtags = emallocz(TAGSZ); - seltags[0] = prevtags[0] = True; + viewtags[0] = emallocz(TAGSZ); + viewtags[1] = emallocz(TAGSZ); + viewtags[0][0] = viewtags[1][0] = True; + seltags = viewtags[0]; /* init bar */ for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {

@@ -1828,9 +1828,9 @@ XFree(wmh);

} } - void view(const char *arg) { + Bool tmp[LENGTH(tags)]; unsigned int i; for(i = 0; i < LENGTH(tags); i++)

@@ -1838,7 +1838,7 @@ tmp[i] = (NULL == arg);

tmp[idxoftag(arg)] = True; if(memcmp(seltags, tmp, TAGSZ) != 0) { - memcpy(prevtags, seltags, TAGSZ); + seltags = viewtags[viewtags_set ^= 1]; /* toggle tagset */ memcpy(seltags, tmp, TAGSZ); arrange(); }

@@ -1846,10 +1846,7 @@ }

void viewprevtag(const char *arg) { - - memcpy(tmp, seltags, TAGSZ); - memcpy(seltags, prevtags, TAGSZ); - memcpy(prevtags, tmp, TAGSZ); + seltags = viewtags[viewtags_set ^= 1]; /* toggle tagset */ arrange(); }