Mercurial > aewl
comparison tag.c @ 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 | 21071ae1fe68 |
children | e890cee887d1 |
comparison
equal
deleted
inserted
replaced
172:af781faa40d6 | 173:1db04019684e |
---|---|
11 | 11 |
12 /* static */ | 12 /* static */ |
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 |
20 TAGS | 20 TAGS |
21 RULES | 21 RULES |
28 appendtag(Arg *arg) | 28 appendtag(Arg *arg) |
29 { | 29 { |
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 |
37 void | 37 void |
38 dofloat(Arg *arg) | 38 dofloat(Arg *arg) |
144 | 144 |
145 if(!sel) | 145 if(!sel) |
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 |
153 void | 153 void |
154 settags(Client *c) | 154 settags(Client *c) |
169 if(!regcomp(®ex, rule[i].pattern, 0)) { | 169 if(!regcomp(®ex, rule[i].pattern, 0)) { |
170 if(!regexec(®ex, classinst, 1, &tmp, 0)) { | 170 if(!regexec(®ex, classinst, 1, &tmp, 0)) { |
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 } |
178 regfree(®ex); | 178 regfree(®ex); |
179 } | 179 } |
182 XFree(ch.res_class); | 182 XFree(ch.res_class); |
183 if(ch.res_name) | 183 if(ch.res_name) |
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 |
191 togglemode(Arg *arg) | 191 togglemode(Arg *arg) |
192 { | 192 { |