summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c2
-rw-r--r--config.arg.h4
-rw-r--r--config.default.h4
-rw-r--r--draw.c8
-rw-r--r--dwm.h7
-rw-r--r--tag.c10
6 files changed, 18 insertions, 17 deletions
diff --git a/client.c b/client.c
index b6bda92..f4ed1a0 100644
--- a/client.c
+++ b/client.c
@@ -18,7 +18,7 @@ resizetitle(Client *c)
18 c->tw = 0; 18 c->tw = 0;
19 for(i = 0; i < TLast; i++) 19 for(i = 0; i < TLast; i++)
20 if(c->tags[i]) 20 if(c->tags[i])
21 c->tw += textw(c->tags[i]); 21 c->tw += textw(tags[i]);
22 c->tw += textw(c->name); 22 c->tw += textw(c->name);
23 if(c->tw > c->w) 23 if(c->tw > c->w)
24 c->tw = c->w + 2; 24 c->tw = c->w + 2;
diff --git a/config.arg.h b/config.arg.h
index 593e4ea..a3d312c 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -5,7 +5,7 @@
5 5
6enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; 6enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
7#define TAGS \ 7#define TAGS \
8char *tags[TLast] = { \ 8const char *tags[TLast] = { \
9 [Tfnord] = "fnord", \ 9 [Tfnord] = "fnord", \
10 [Tdev] = "dev", \ 10 [Tdev] = "dev", \
11 [Tnet] = "net", \ 11 [Tnet] = "net", \
@@ -66,7 +66,7 @@ static Key key[] = { \
66#define RULES \ 66#define RULES \
67static Rule rule[] = { \ 67static Rule rule[] = { \
68 /* class:instance tags isfloat */ \ 68 /* class:instance tags isfloat */ \
69 { "Firefox.*", { [Tnet] = "net" }, False }, \ 69 { "Firefox.*", { [Tnet] = True }, False }, \
70 { "Gimp.*", { 0 }, True}, \ 70 { "Gimp.*", { 0 }, True}, \
71 { "MPlayer.*", { 0 }, True}, \ 71 { "MPlayer.*", { 0 }, True}, \
72 { "Acroread.*", { 0 }, True}, \ 72 { "Acroread.*", { 0 }, True}, \
diff --git a/config.default.h b/config.default.h
index 3b6eb16..ec1804f 100644
--- a/config.default.h
+++ b/config.default.h
@@ -5,7 +5,7 @@
5 5
6enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; 6enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
7#define TAGS \ 7#define TAGS \
8char *tags[TLast] = { \ 8const char *tags[TLast] = { \
9 [Tfnord] = "fnord", \ 9 [Tfnord] = "fnord", \
10 [Tdev] = "dev", \ 10 [Tdev] = "dev", \
11 [Tnet] = "net", \ 11 [Tnet] = "net", \
@@ -57,6 +57,6 @@ static Key key[] = { \
57#define RULES \ 57#define RULES \
58static Rule rule[] = { \ 58static Rule rule[] = { \
59 /* class:instance tags isfloat */ \ 59 /* class:instance tags isfloat */ \
60 { "Firefox.*", { [Tnet] = "net" }, False }, \ 60 { "Firefox.*", { [Tnet] = True }, False }, \
61 { "Gimp.*", { 0 }, True}, \ 61 { "Gimp.*", { 0 }, True}, \
62}; 62};
diff --git a/draw.c b/draw.c
index 4ba5cd6..506a862 100644
--- a/draw.c
+++ b/draw.c
@@ -30,7 +30,7 @@ drawborder(void)
30} 30}
31 31
32static unsigned int 32static unsigned int
33textnw(char *text, unsigned int len) 33textnw(const char *text, unsigned int len)
34{ 34{
35 XRectangle r; 35 XRectangle r;
36 36
@@ -156,8 +156,8 @@ drawtitle(Client *c)
156 for(i = 0; i < TLast; i++) { 156 for(i = 0; i < TLast; i++) {
157 if(c->tags[i]) { 157 if(c->tags[i]) {
158 dc.x += dc.w; 158 dc.x += dc.w;
159 dc.w = textw(c->tags[i]); 159 dc.w = textw(tags[i]);
160 drawtext(c->tags[i], !istile, True); 160 drawtext(tags[i], !istile, True);
161 } 161 }
162 } 162 }
163 dc.x += dc.w; 163 dc.x += dc.w;
@@ -229,7 +229,7 @@ setfont(const char *fontstr)
229} 229}
230 230
231unsigned int 231unsigned int
232textw(char *text) 232textw(const char *text)
233{ 233{
234 return textnw(text, strlen(text)) + dc.font.height; 234 return textnw(text, strlen(text)) + dc.font.height;
235} 235}
diff --git a/dwm.h b/dwm.h
index 68b307d..c44da29 100644
--- a/dwm.h
+++ b/dwm.h
@@ -51,7 +51,6 @@ struct DC { /* draw context */
51 51
52struct Client { 52struct Client {
53 char name[256]; 53 char name[256];
54 char *tags[TLast];
55 int proto; 54 int proto;
56 int x, y, w, h; 55 int x, y, w, h;
57 int tx, ty, tw, th; /* title */ 56 int tx, ty, tw, th; /* title */
@@ -61,13 +60,15 @@ struct Client {
61 unsigned int border; 60 unsigned int border;
62 Bool isfloat; 61 Bool isfloat;
63 Bool ismax; 62 Bool ismax;
63 Bool tags[TLast];
64 Client *next; 64 Client *next;
65 Client *prev; 65 Client *prev;
66 Window win; 66 Window win;
67 Window title; 67 Window title;
68}; 68};
69 69
70extern char *tags[TLast], stext[1024]; 70extern const char *tags[TLast];
71extern char stext[1024];
71extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; 72extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
72extern void (*handler[LASTEvent])(XEvent *); 73extern void (*handler[LASTEvent])(XEvent *);
73extern void (*arrange)(Arg *); 74extern void (*arrange)(Arg *);
@@ -104,7 +105,7 @@ extern void drawstatus();
104extern void drawtitle(Client *c); 105extern void drawtitle(Client *c);
105extern unsigned long getcolor(const char *colstr); 106extern unsigned long getcolor(const char *colstr);
106extern void setfont(const char *fontstr); 107extern void setfont(const char *fontstr);
107extern unsigned int textw(char *text); 108extern unsigned int textw(const char *text);
108 109
109/* event.c */ 110/* event.c */
110extern void grabkeys(); 111extern void grabkeys();
diff --git a/tag.c b/tag.c
index f4ddfd9..448ed2a 100644
--- a/tag.c
+++ b/tag.c
@@ -13,7 +13,7 @@
13 13
14typedef struct { 14typedef struct {
15 const char *pattern; 15 const char *pattern;
16 char *tags[TLast]; 16 Bool tags[TLast];
17 Bool isfloat; 17 Bool isfloat;
18} Rule; 18} Rule;
19 19
@@ -30,7 +30,7 @@ appendtag(Arg *arg)
30 if(!sel) 30 if(!sel)
31 return; 31 return;
32 32
33 sel->tags[arg->i] = tags[arg->i]; 33 sel->tags[arg->i] = True;
34 arrange(NULL); 34 arrange(NULL);
35} 35}
36 36
@@ -146,7 +146,7 @@ replacetag(Arg *arg)
146 return; 146 return;
147 147
148 for(i = 0; i < TLast; i++) 148 for(i = 0; i < TLast; i++)
149 sel->tags[i] = NULL; 149 sel->tags[i] = False;
150 appendtag(arg); 150 appendtag(arg);
151} 151}
152 152
@@ -171,7 +171,7 @@ settags(Client *c)
171 for(j = 0; j < TLast; j++) { 171 for(j = 0; j < TLast; j++) {
172 if(rule[i].tags[j]) 172 if(rule[i].tags[j])
173 matched = True; 173 matched = True;
174 c->tags[j] = rule[i].tags[j]; 174 c->tags[j] = True;
175 } 175 }
176 c->isfloat = rule[i].isfloat; 176 c->isfloat = rule[i].isfloat;
177 } 177 }
@@ -184,7 +184,7 @@ settags(Client *c)
184 XFree(ch.res_name); 184 XFree(ch.res_name);
185 } 185 }
186 if(!matched) 186 if(!matched)
187 c->tags[tsel] = tags[tsel]; 187 c->tags[tsel] = True;
188} 188}
189 189
190void 190void