diff options
| author | anselm@anselm1 <unknown> | 2008-04-20 18:35:11 +0100 |
|---|---|---|
| committer | anselm@anselm1 <unknown> | 2008-04-20 18:35:11 +0100 |
| commit | c05962512840e181356750fd2061f8430d7193ed (patch) | |
| tree | fa76b8f5f3df64f8e5721620b1003b08a1164c1f /dwm.c | |
| parent | applied Ph's MIN/MAX patch, nice work! (diff) | |
| download | dwm-c05962512840e181356750fd2061f8430d7193ed.tar.gz dwm-c05962512840e181356750fd2061f8430d7193ed.zip | |
applied Ph's seltags-simplification with some modifications
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 23 |
1 files changed, 10 insertions, 13 deletions
| @@ -214,6 +214,7 @@ char stext[256], buf[256]; | |||
| 214 | int screen, sx, sy, sw, sh; | 214 | int screen, sx, sy, sw, sh; |
| 215 | int (*xerrorxlib)(Display *, XErrorEvent *); | 215 | int (*xerrorxlib)(Display *, XErrorEvent *); |
| 216 | int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; | 216 | int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; |
| 217 | int viewtags_set = 0; | ||
| 217 | double mfact; | 218 | double mfact; |
| 218 | unsigned int numlockmask = 0; | 219 | unsigned int numlockmask = 0; |
| 219 | void (*handler[LASTEvent]) (XEvent *) = { | 220 | void (*handler[LASTEvent]) (XEvent *) = { |
| @@ -233,8 +234,8 @@ void (*handler[LASTEvent]) (XEvent *) = { | |||
| 233 | Atom wmatom[WMLast], netatom[NetLast]; | 234 | Atom wmatom[WMLast], netatom[NetLast]; |
| 234 | Bool otherwm, readin; | 235 | Bool otherwm, readin; |
| 235 | Bool running = True; | 236 | Bool running = True; |
| 236 | Bool *prevtags; | ||
| 237 | Bool *seltags; | 237 | Bool *seltags; |
| 238 | Bool *viewtags[2]; | ||
| 238 | Client *clients = NULL; | 239 | Client *clients = NULL; |
| 239 | Client *sel = NULL; | 240 | Client *sel = NULL; |
| 240 | Client *stack = NULL; | 241 | Client *stack = NULL; |
| @@ -246,7 +247,6 @@ Window root, barwin; | |||
| 246 | /* configuration, allows nested code to access above variables */ | 247 | /* configuration, allows nested code to access above variables */ |
| 247 | #include "config.h" | 248 | #include "config.h" |
| 248 | #define TAGSZ (LENGTH(tags) * sizeof(Bool)) | 249 | #define TAGSZ (LENGTH(tags) * sizeof(Bool)) |
| 249 | Bool tmp[LENGTH(tags)]; | ||
| 250 | Layout *lt = layouts; | 250 | Layout *lt = layouts; |
| 251 | Geom *geom = geoms; | 251 | Geom *geom = geoms; |
| 252 | 252 | ||
| @@ -1158,11 +1158,10 @@ quit(const char *arg) { | |||
| 1158 | 1158 | ||
| 1159 | void | 1159 | void |
| 1160 | reapply(const char *arg) { | 1160 | reapply(const char *arg) { |
| 1161 | static Bool zerotags[LENGTH(tags)] = { 0 }; | ||
| 1162 | Client *c; | 1161 | Client *c; |
| 1163 | 1162 | ||
| 1164 | for(c = clients; c; c = c->next) { | 1163 | for(c = clients; c; c = c->next) { |
| 1165 | memcpy(c->tags, zerotags, sizeof zerotags); | 1164 | memset(c->tags, 0, TAGSZ); |
| 1166 | applyrules(c); | 1165 | applyrules(c); |
| 1167 | } | 1166 | } |
| 1168 | arrange(); | 1167 | arrange(); |
| @@ -1506,9 +1505,10 @@ setup(void) { | |||
| 1506 | XSetFont(dpy, dc.gc, dc.font.xfont->fid); | 1505 | XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
| 1507 | 1506 | ||
| 1508 | /* init tags */ | 1507 | /* init tags */ |
| 1509 | seltags = emallocz(TAGSZ); | 1508 | viewtags[0] = emallocz(TAGSZ); |
| 1510 | prevtags = emallocz(TAGSZ); | 1509 | viewtags[1] = emallocz(TAGSZ); |
| 1511 | seltags[0] = prevtags[0] = True; | 1510 | viewtags[0][0] = viewtags[1][0] = True; |
| 1511 | seltags = viewtags[0]; | ||
| 1512 | 1512 | ||
| 1513 | /* init bar */ | 1513 | /* init bar */ |
| 1514 | for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { | 1514 | for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { |
| @@ -1828,9 +1828,9 @@ updatewmhints(Client *c) { | |||
| 1828 | } | 1828 | } |
| 1829 | } | 1829 | } |
| 1830 | 1830 | ||
| 1831 | |||
| 1832 | void | 1831 | void |
| 1833 | view(const char *arg) { | 1832 | view(const char *arg) { |
| 1833 | Bool tmp[LENGTH(tags)]; | ||
| 1834 | unsigned int i; | 1834 | unsigned int i; |
| 1835 | 1835 | ||
| 1836 | for(i = 0; i < LENGTH(tags); i++) | 1836 | for(i = 0; i < LENGTH(tags); i++) |
| @@ -1838,7 +1838,7 @@ view(const char *arg) { | |||
| 1838 | tmp[idxoftag(arg)] = True; | 1838 | tmp[idxoftag(arg)] = True; |
| 1839 | 1839 | ||
| 1840 | if(memcmp(seltags, tmp, TAGSZ) != 0) { | 1840 | if(memcmp(seltags, tmp, TAGSZ) != 0) { |
| 1841 | memcpy(prevtags, seltags, TAGSZ); | 1841 | seltags = viewtags[viewtags_set ^= 1]; /* toggle tagset */ |
| 1842 | memcpy(seltags, tmp, TAGSZ); | 1842 | memcpy(seltags, tmp, TAGSZ); |
| 1843 | arrange(); | 1843 | arrange(); |
| 1844 | } | 1844 | } |
| @@ -1846,10 +1846,7 @@ view(const char *arg) { | |||
| 1846 | 1846 | ||
| 1847 | void | 1847 | void |
| 1848 | viewprevtag(const char *arg) { | 1848 | viewprevtag(const char *arg) { |
| 1849 | 1849 | seltags = viewtags[viewtags_set ^= 1]; /* toggle tagset */ | |
| 1850 | memcpy(tmp, seltags, TAGSZ); | ||
| 1851 | memcpy(seltags, prevtags, TAGSZ); | ||
| 1852 | memcpy(prevtags, tmp, TAGSZ); | ||
| 1853 | arrange(); | 1850 | arrange(); |
| 1854 | } | 1851 | } |
| 1855 | 1852 | ||
