renamed char prop[] into buf[]
b18e6840
2 file(s) · +27 −27
| 7 | 7 | ||
| 8 | 8 | /* static */ |
|
| 9 | 9 | ||
| 10 | - | static char prop[128]; |
|
| 10 | + | static char buf[128]; |
|
| 11 | 11 | ||
| 12 | 12 | static void |
|
| 13 | 13 | attachstack(Client *c) { |
|
| 186 | 186 | unsigned int i; |
|
| 187 | 187 | Bool result = False; |
|
| 188 | 188 | ||
| 189 | - | if(gettextprop(c->win, dwmprops, prop, sizeof prop)) { |
|
| 190 | - | for(i = 0; i < ntags && i < sizeof prop - 1 && prop[i] != '\0'; i++) |
|
| 191 | - | if((c->tags[i] = prop[i] == '1')) |
|
| 189 | + | if(gettextprop(c->win, dwmprops, buf, sizeof buf)) { |
|
| 190 | + | for(i = 0; i < ntags && i < sizeof buf - 1 && buf[i] != '\0'; i++) |
|
| 191 | + | if((c->tags[i] = buf[i] == '1')) |
|
| 192 | 192 | result = True; |
|
| 193 | - | if(i < sizeof prop - 1 && prop[i] != '\0') |
|
| 194 | - | c->isfloating = prop[i] == '1'; |
|
| 193 | + | if(i < sizeof buf - 1 && buf[i] != '\0') |
|
| 194 | + | c->isfloating = buf[i] == '1'; |
|
| 195 | 195 | } |
|
| 196 | 196 | return result; |
|
| 197 | 197 | } |
|
| 321 | 321 | setprops(Client *c) { |
|
| 322 | 322 | unsigned int i; |
|
| 323 | 323 | ||
| 324 | - | for(i = 0; i < ntags && i < sizeof prop - 1; i++) |
|
| 325 | - | prop[i] = c->tags[i] ? '1' : '0'; |
|
| 326 | - | if(i < sizeof prop - 1) |
|
| 327 | - | prop[i++] = c->isfloating ? '1' : '0'; |
|
| 328 | - | prop[i] = '\0'; |
|
| 324 | + | for(i = 0; i < ntags && i < sizeof buf - 1; i++) |
|
| 325 | + | buf[i] = c->tags[i] ? '1' : '0'; |
|
| 326 | + | if(i < sizeof buf - 1) |
|
| 327 | + | buf[i++] = c->isfloating ? '1' : '0'; |
|
| 328 | + | buf[i] = '\0'; |
|
| 329 | 329 | XChangeProperty(dpy, c->win, dwmprops, XA_STRING, 8, |
|
| 330 | - | PropModeReplace, (unsigned char *)prop, i); |
|
| 330 | + | PropModeReplace, (unsigned char *)buf, i); |
|
| 331 | 331 | } |
|
| 332 | 332 | ||
| 333 | 333 | void |
|
| 28 | 28 | TAGS |
|
| 29 | 29 | RULES |
|
| 30 | 30 | ||
| 31 | - | static char prop[512]; |
|
| 31 | + | static char buf[512]; |
|
| 32 | 32 | static unsigned int nrules = 0; |
|
| 33 | 33 | static unsigned int nlayouts = 0; |
|
| 34 | 34 | static unsigned int ltidx = 0; /* default */ |
|
| 57 | 57 | setdwmprops(void) { |
|
| 58 | 58 | unsigned int i; |
|
| 59 | 59 | ||
| 60 | - | for(i = 0; i < ntags && i < sizeof prop - 1; i++) |
|
| 61 | - | prop[i] = seltags[i] ? '1' : '0'; |
|
| 62 | - | if(i < sizeof prop - 1) |
|
| 63 | - | prop[i++] = (char)ltidx + '0'; |
|
| 64 | - | prop[i] = '\0'; |
|
| 60 | + | for(i = 0; i < ntags && i < sizeof buf - 1; i++) |
|
| 61 | + | buf[i] = seltags[i] ? '1' : '0'; |
|
| 62 | + | if(i < sizeof buf - 1) |
|
| 63 | + | buf[i++] = (char)ltidx + '0'; |
|
| 64 | + | buf[i] = '\0'; |
|
| 65 | 65 | XChangeProperty(dpy, root, dwmprops, XA_STRING, 8, |
|
| 66 | - | PropModeReplace, (unsigned char *)prop, i); |
|
| 66 | + | PropModeReplace, (unsigned char *)buf, i); |
|
| 67 | 67 | } |
|
| 68 | 68 | ||
| 69 | 69 | LAYOUTS |
|
| 81 | 81 | ||
| 82 | 82 | /* rule matching */ |
|
| 83 | 83 | XGetClassHint(dpy, c->win, &ch); |
|
| 84 | - | snprintf(prop, sizeof prop, "%s:%s:%s", |
|
| 84 | + | snprintf(buf, sizeof buf, "%s:%s:%s", |
|
| 85 | 85 | ch.res_class ? ch.res_class : "", |
|
| 86 | 86 | ch.res_name ? ch.res_name : "", c->name); |
|
| 87 | 87 | for(i = 0; i < nrules; i++) |
|
| 88 | - | if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { |
|
| 88 | + | if(regs[i].propregex && !regexec(regs[i].propregex, buf, 1, &tmp, 0)) { |
|
| 89 | 89 | c->isfloating = rules[i].isfloating; |
|
| 90 | 90 | for(j = 0; regs[i].tagregex && j < ntags; j++) { |
|
| 91 | 91 | if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { |
|
| 219 | 219 | getdwmprops(void) { |
|
| 220 | 220 | unsigned int i; |
|
| 221 | 221 | ||
| 222 | - | if(gettextprop(root, dwmprops, prop, sizeof prop)) { |
|
| 223 | - | for(i = 0; i < ntags && i < sizeof prop - 1 && prop[i] != '\0'; i++) |
|
| 224 | - | seltags[i] = prop[i] == '1'; |
|
| 225 | - | if(i < sizeof prop - 1 && prop[i] != '\0') { |
|
| 226 | - | if((unsigned int)(prop[i] - '0') < nlayouts) |
|
| 227 | - | ltidx = prop[i] - '0'; |
|
| 222 | + | if(gettextprop(root, dwmprops, buf, sizeof buf)) { |
|
| 223 | + | for(i = 0; i < ntags && i < sizeof buf - 1 && buf[i] != '\0'; i++) |
|
| 224 | + | seltags[i] = buf[i] == '1'; |
|
| 225 | + | if(i < sizeof buf - 1 && buf[i] != '\0') { |
|
| 226 | + | if((unsigned int)(buf[i] - '0') < nlayouts) |
|
| 227 | + | ltidx = buf[i] - '0'; |
|
| 228 | 228 | } |
|
| 229 | 229 | } |
|
| 230 | 230 | } |
|