tchanged Client->tags and Rule->tags to be Bool (I'll also try to remove the TL… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 8cc7f3bace087dfb024a23115c211d82b35614ae | |
parent 5d3fd3707b262508d1750cf95ac2e2f666be6163 | |
Author: [email protected] <unknown> | |
Date: Thu, 3 Aug 2006 10:55:07 +0200 | |
changed Client->tags and Rule->tags to be Bool (I'll also try to remove the TLa… | |
Diffstat: | |
M client.c | 2 +- | |
M config.arg.h | 4 ++-- | |
M config.default.h | 4 ++-- | |
M draw.c | 8 ++++---- | |
M dwm.h | 7 ++++--- | |
M tag.c | 10 +++++----- | |
6 files changed, 18 insertions(+), 17 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -18,7 +18,7 @@ resizetitle(Client *c) | |
c->tw = 0; | |
for(i = 0; i < TLast; i++) | |
if(c->tags[i]) | |
- c->tw += textw(c->tags[i]); | |
+ c->tw += textw(tags[i]); | |
c->tw += textw(c->name); | |
if(c->tw > c->w) | |
c->tw = c->w + 2; | |
diff --git a/config.arg.h b/config.arg.h | |
t@@ -5,7 +5,7 @@ | |
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | |
#define TAGS \ | |
-char *tags[TLast] = { \ | |
+const char *tags[TLast] = { \ | |
[Tfnord] = "fnord", \ | |
[Tdev] = "dev", \ | |
[Tnet] = "net", \ | |
t@@ -66,7 +66,7 @@ static Key key[] = { \ | |
#define RULES \ | |
static Rule rule[] = { \ | |
/* class:instance tags isfloat *… | |
- { "Firefox.*", { [Tnet] = "net" }, False… | |
+ { "Firefox.*", { [Tnet] = True }, False … | |
{ "Gimp.*", { 0 }, True}… | |
{ "MPlayer.*", { 0 }, Tr… | |
{ "Acroread.*", { 0 }, T… | |
diff --git a/config.default.h b/config.default.h | |
t@@ -5,7 +5,7 @@ | |
enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | |
#define TAGS \ | |
-char *tags[TLast] = { \ | |
+const char *tags[TLast] = { \ | |
[Tfnord] = "fnord", \ | |
[Tdev] = "dev", \ | |
[Tnet] = "net", \ | |
t@@ -57,6 +57,6 @@ static Key key[] = { \ | |
#define RULES \ | |
static Rule rule[] = { \ | |
/* class:instance tags isfloat *… | |
- { "Firefox.*", { [Tnet] = "net" }, False… | |
+ { "Firefox.*", { [Tnet] = True }, False … | |
{ "Gimp.*", { 0 }, True}… | |
}; | |
diff --git a/draw.c b/draw.c | |
t@@ -30,7 +30,7 @@ drawborder(void) | |
} | |
static unsigned int | |
-textnw(char *text, unsigned int len) | |
+textnw(const char *text, unsigned int len) | |
{ | |
XRectangle r; | |
t@@ -156,8 +156,8 @@ drawtitle(Client *c) | |
for(i = 0; i < TLast; i++) { | |
if(c->tags[i]) { | |
dc.x += dc.w; | |
- dc.w = textw(c->tags[i]); | |
- drawtext(c->tags[i], !istile, True); | |
+ dc.w = textw(tags[i]); | |
+ drawtext(tags[i], !istile, True); | |
} | |
} | |
dc.x += dc.w; | |
t@@ -229,7 +229,7 @@ setfont(const char *fontstr) | |
} | |
unsigned int | |
-textw(char *text) | |
+textw(const char *text) | |
{ | |
return textnw(text, strlen(text)) + dc.font.height; | |
} | |
diff --git a/dwm.h b/dwm.h | |
t@@ -51,7 +51,6 @@ struct DC { /* draw context */ | |
struct Client { | |
char name[256]; | |
- char *tags[TLast]; | |
int proto; | |
int x, y, w, h; | |
int tx, ty, tw, th; /* title */ | |
t@@ -61,13 +60,15 @@ struct Client { | |
unsigned int border; | |
Bool isfloat; | |
Bool ismax; | |
+ Bool tags[TLast]; | |
Client *next; | |
Client *prev; | |
Window win; | |
Window title; | |
}; | |
-extern char *tags[TLast], stext[1024]; | |
+extern const char *tags[TLast]; | |
+extern char stext[1024]; | |
extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; | |
extern void (*handler[LASTEvent])(XEvent *); | |
extern void (*arrange)(Arg *); | |
t@@ -104,7 +105,7 @@ extern void drawstatus(); | |
extern void drawtitle(Client *c); | |
extern unsigned long getcolor(const char *colstr); | |
extern void setfont(const char *fontstr); | |
-extern unsigned int textw(char *text); | |
+extern unsigned int textw(const char *text); | |
/* event.c */ | |
extern void grabkeys(); | |
diff --git a/tag.c b/tag.c | |
t@@ -13,7 +13,7 @@ | |
typedef struct { | |
const char *pattern; | |
- char *tags[TLast]; | |
+ Bool tags[TLast]; | |
Bool isfloat; | |
} Rule; | |
t@@ -30,7 +30,7 @@ appendtag(Arg *arg) | |
if(!sel) | |
return; | |
- sel->tags[arg->i] = tags[arg->i]; | |
+ sel->tags[arg->i] = True; | |
arrange(NULL); | |
} | |
t@@ -146,7 +146,7 @@ replacetag(Arg *arg) | |
return; | |
for(i = 0; i < TLast; i++) | |
- sel->tags[i] = NULL; | |
+ sel->tags[i] = False; | |
appendtag(arg); | |
} | |
t@@ -171,7 +171,7 @@ settags(Client *c) | |
for(j = 0; j < TLast; j++) { | |
if(rule[i].tags[j]) | |
matched = True; | |
- c->tags[j] = rule[i].tags[j]; | |
+ c->tags[j] = True; | |
} | |
c->isfloat = rule[i].isfloat; | |
} | |
t@@ -184,7 +184,7 @@ settags(Client *c) | |
XFree(ch.res_name); | |
} | |
if(!matched) | |
- c->tags[tsel] = tags[tsel]; | |
+ c->tags[tsel] = True; | |
} | |
void |