dwm-meillo
changeset 173:1db04019684e
changed Client->tags and Rule->tags to be Bool (I'll also try to remove the TLast enum)
author | arg@10ksloc.org |
---|---|
date | Thu, 03 Aug 2006 10:55:07 +0200 |
parents | af781faa40d6 |
children | 48c820470858 |
files | client.c config.arg.h config.default.h draw.c dwm.h tag.c |
diffstat | 6 files changed, 18 insertions(+), 17 deletions(-) [+] |
line diff
1.1 --- a/client.c Wed Aug 02 17:49:21 2006 +0200 1.2 +++ b/client.c Thu Aug 03 10:55:07 2006 +0200 1.3 @@ -18,7 +18,7 @@ 1.4 c->tw = 0; 1.5 for(i = 0; i < TLast; i++) 1.6 if(c->tags[i]) 1.7 - c->tw += textw(c->tags[i]); 1.8 + c->tw += textw(tags[i]); 1.9 c->tw += textw(c->name); 1.10 if(c->tw > c->w) 1.11 c->tw = c->w + 2;
2.1 --- a/config.arg.h Wed Aug 02 17:49:21 2006 +0200 2.2 +++ b/config.arg.h Thu Aug 03 10:55:07 2006 +0200 2.3 @@ -5,7 +5,7 @@ 2.4 2.5 enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; 2.6 #define TAGS \ 2.7 -char *tags[TLast] = { \ 2.8 +const char *tags[TLast] = { \ 2.9 [Tfnord] = "fnord", \ 2.10 [Tdev] = "dev", \ 2.11 [Tnet] = "net", \ 2.12 @@ -66,7 +66,7 @@ 2.13 #define RULES \ 2.14 static Rule rule[] = { \ 2.15 /* class:instance tags isfloat */ \ 2.16 - { "Firefox.*", { [Tnet] = "net" }, False }, \ 2.17 + { "Firefox.*", { [Tnet] = True }, False }, \ 2.18 { "Gimp.*", { 0 }, True}, \ 2.19 { "MPlayer.*", { 0 }, True}, \ 2.20 { "Acroread.*", { 0 }, True}, \
3.1 --- a/config.default.h Wed Aug 02 17:49:21 2006 +0200 3.2 +++ b/config.default.h Thu Aug 03 10:55:07 2006 +0200 3.3 @@ -5,7 +5,7 @@ 3.4 3.5 enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; 3.6 #define TAGS \ 3.7 -char *tags[TLast] = { \ 3.8 +const char *tags[TLast] = { \ 3.9 [Tfnord] = "fnord", \ 3.10 [Tdev] = "dev", \ 3.11 [Tnet] = "net", \ 3.12 @@ -57,6 +57,6 @@ 3.13 #define RULES \ 3.14 static Rule rule[] = { \ 3.15 /* class:instance tags isfloat */ \ 3.16 - { "Firefox.*", { [Tnet] = "net" }, False }, \ 3.17 + { "Firefox.*", { [Tnet] = True }, False }, \ 3.18 { "Gimp.*", { 0 }, True}, \ 3.19 };
4.1 --- a/draw.c Wed Aug 02 17:49:21 2006 +0200 4.2 +++ b/draw.c Thu Aug 03 10:55:07 2006 +0200 4.3 @@ -30,7 +30,7 @@ 4.4 } 4.5 4.6 static unsigned int 4.7 -textnw(char *text, unsigned int len) 4.8 +textnw(const char *text, unsigned int len) 4.9 { 4.10 XRectangle r; 4.11 4.12 @@ -156,8 +156,8 @@ 4.13 for(i = 0; i < TLast; i++) { 4.14 if(c->tags[i]) { 4.15 dc.x += dc.w; 4.16 - dc.w = textw(c->tags[i]); 4.17 - drawtext(c->tags[i], !istile, True); 4.18 + dc.w = textw(tags[i]); 4.19 + drawtext(tags[i], !istile, True); 4.20 } 4.21 } 4.22 dc.x += dc.w; 4.23 @@ -229,7 +229,7 @@ 4.24 } 4.25 4.26 unsigned int 4.27 -textw(char *text) 4.28 +textw(const char *text) 4.29 { 4.30 return textnw(text, strlen(text)) + dc.font.height; 4.31 }
5.1 --- a/dwm.h Wed Aug 02 17:49:21 2006 +0200 5.2 +++ b/dwm.h Thu Aug 03 10:55:07 2006 +0200 5.3 @@ -51,7 +51,6 @@ 5.4 5.5 struct Client { 5.6 char name[256]; 5.7 - char *tags[TLast]; 5.8 int proto; 5.9 int x, y, w, h; 5.10 int tx, ty, tw, th; /* title */ 5.11 @@ -61,13 +60,15 @@ 5.12 unsigned int border; 5.13 Bool isfloat; 5.14 Bool ismax; 5.15 + Bool tags[TLast]; 5.16 Client *next; 5.17 Client *prev; 5.18 Window win; 5.19 Window title; 5.20 }; 5.21 5.22 -extern char *tags[TLast], stext[1024]; 5.23 +extern const char *tags[TLast]; 5.24 +extern char stext[1024]; 5.25 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; 5.26 extern void (*handler[LASTEvent])(XEvent *); 5.27 extern void (*arrange)(Arg *); 5.28 @@ -104,7 +105,7 @@ 5.29 extern void drawtitle(Client *c); 5.30 extern unsigned long getcolor(const char *colstr); 5.31 extern void setfont(const char *fontstr); 5.32 -extern unsigned int textw(char *text); 5.33 +extern unsigned int textw(const char *text); 5.34 5.35 /* event.c */ 5.36 extern void grabkeys();
6.1 --- a/tag.c Wed Aug 02 17:49:21 2006 +0200 6.2 +++ b/tag.c Thu Aug 03 10:55:07 2006 +0200 6.3 @@ -13,7 +13,7 @@ 6.4 6.5 typedef struct { 6.6 const char *pattern; 6.7 - char *tags[TLast]; 6.8 + Bool tags[TLast]; 6.9 Bool isfloat; 6.10 } Rule; 6.11 6.12 @@ -30,7 +30,7 @@ 6.13 if(!sel) 6.14 return; 6.15 6.16 - sel->tags[arg->i] = tags[arg->i]; 6.17 + sel->tags[arg->i] = True; 6.18 arrange(NULL); 6.19 } 6.20 6.21 @@ -146,7 +146,7 @@ 6.22 return; 6.23 6.24 for(i = 0; i < TLast; i++) 6.25 - sel->tags[i] = NULL; 6.26 + sel->tags[i] = False; 6.27 appendtag(arg); 6.28 } 6.29 6.30 @@ -171,7 +171,7 @@ 6.31 for(j = 0; j < TLast; j++) { 6.32 if(rule[i].tags[j]) 6.33 matched = True; 6.34 - c->tags[j] = rule[i].tags[j]; 6.35 + c->tags[j] = True; 6.36 } 6.37 c->isfloat = rule[i].isfloat; 6.38 } 6.39 @@ -184,7 +184,7 @@ 6.40 XFree(ch.res_name); 6.41 } 6.42 if(!matched) 6.43 - c->tags[tsel] = tags[tsel]; 6.44 + c->tags[tsel] = True; 6.45 } 6.46 6.47 void