diff options
Diffstat (limited to '')
| -rw-r--r-- | client.c | 2 | ||||
| -rw-r--r-- | config.arg.h | 4 | ||||
| -rw-r--r-- | config.default.h | 4 | ||||
| -rw-r--r-- | draw.c | 8 | ||||
| -rw-r--r-- | dwm.h | 7 | ||||
| -rw-r--r-- | tag.c | 10 |
6 files changed, 18 insertions, 17 deletions
| @@ -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 | ||
| 6 | enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | 6 | enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; |
| 7 | #define TAGS \ | 7 | #define TAGS \ |
| 8 | char *tags[TLast] = { \ | 8 | const 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 \ |
| 67 | static Rule rule[] = { \ | 67 | static 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 | ||
| 6 | enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; | 6 | enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast }; |
| 7 | #define TAGS \ | 7 | #define TAGS \ |
| 8 | char *tags[TLast] = { \ | 8 | const 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 \ |
| 58 | static Rule rule[] = { \ | 58 | static 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 | }; |
| @@ -30,7 +30,7 @@ drawborder(void) | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static unsigned int | 32 | static unsigned int |
| 33 | textnw(char *text, unsigned int len) | 33 | textnw(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 | ||
| 231 | unsigned int | 231 | unsigned int |
| 232 | textw(char *text) | 232 | textw(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 | } |
| @@ -51,7 +51,6 @@ struct DC { /* draw context */ | |||
| 51 | 51 | ||
| 52 | struct Client { | 52 | struct 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 | ||
| 70 | extern char *tags[TLast], stext[1024]; | 70 | extern const char *tags[TLast]; |
| 71 | extern char stext[1024]; | ||
| 71 | extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; | 72 | extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; |
| 72 | extern void (*handler[LASTEvent])(XEvent *); | 73 | extern void (*handler[LASTEvent])(XEvent *); |
| 73 | extern void (*arrange)(Arg *); | 74 | extern void (*arrange)(Arg *); |
| @@ -104,7 +105,7 @@ extern void drawstatus(); | |||
| 104 | extern void drawtitle(Client *c); | 105 | extern void drawtitle(Client *c); |
| 105 | extern unsigned long getcolor(const char *colstr); | 106 | extern unsigned long getcolor(const char *colstr); |
| 106 | extern void setfont(const char *fontstr); | 107 | extern void setfont(const char *fontstr); |
| 107 | extern unsigned int textw(char *text); | 108 | extern unsigned int textw(const char *text); |
| 108 | 109 | ||
| 109 | /* event.c */ | 110 | /* event.c */ |
| 110 | extern void grabkeys(); | 111 | extern void grabkeys(); |
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | typedef struct { | 14 | typedef 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 | ||
| 190 | void | 190 | void |
