summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authoranselm@anselm1 <unknown>2008-04-20 18:35:11 +0100
committeranselm@anselm1 <unknown>2008-04-20 18:35:11 +0100
commitc05962512840e181356750fd2061f8430d7193ed (patch)
treefa76b8f5f3df64f8e5721620b1003b08a1164c1f /dwm.c
parentapplied Ph's MIN/MAX patch, nice work! (diff)
downloaddwm-c05962512840e181356750fd2061f8430d7193ed.tar.gz
dwm-c05962512840e181356750fd2061f8430d7193ed.zip
applied Ph's seltags-simplification with some modifications
Diffstat (limited to '')
-rw-r--r--dwm.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/dwm.c b/dwm.c
index 7f2a638..8c51275 100644
--- a/dwm.c
+++ b/dwm.c
@@ -214,6 +214,7 @@ char stext[256], buf[256];
214int screen, sx, sy, sw, sh; 214int screen, sx, sy, sw, sh;
215int (*xerrorxlib)(Display *, XErrorEvent *); 215int (*xerrorxlib)(Display *, XErrorEvent *);
216int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; 216int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
217int viewtags_set = 0;
217double mfact; 218double mfact;
218unsigned int numlockmask = 0; 219unsigned int numlockmask = 0;
219void (*handler[LASTEvent]) (XEvent *) = { 220void (*handler[LASTEvent]) (XEvent *) = {
@@ -233,8 +234,8 @@ void (*handler[LASTEvent]) (XEvent *) = {
233Atom wmatom[WMLast], netatom[NetLast]; 234Atom wmatom[WMLast], netatom[NetLast];
234Bool otherwm, readin; 235Bool otherwm, readin;
235Bool running = True; 236Bool running = True;
236Bool *prevtags;
237Bool *seltags; 237Bool *seltags;
238Bool *viewtags[2];
238Client *clients = NULL; 239Client *clients = NULL;
239Client *sel = NULL; 240Client *sel = NULL;
240Client *stack = NULL; 241Client *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))
249Bool tmp[LENGTH(tags)];
250Layout *lt = layouts; 250Layout *lt = layouts;
251Geom *geom = geoms; 251Geom *geom = geoms;
252 252
@@ -1158,11 +1158,10 @@ quit(const char *arg) {
1158 1158
1159void 1159void
1160reapply(const char *arg) { 1160reapply(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
1832void 1831void
1833view(const char *arg) { 1832view(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
1847void 1847void
1848viewprevtag(const char *arg) { 1848viewprevtag(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