commit 1cfea0d215c18df364b8f59ed5daced19e8f4160
parent 3c5dd59018ee8b60a1b5320befb3c4c71e993fcd
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Tue, 14 Mar 2006 10:33:50 +0100
fixed update_tags, hopefully
Diffstat:
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/cmd/wm/tag.c b/cmd/wm/tag.c
@@ -32,6 +32,14 @@ alloc_tag(char *name)
alloc_area(t);
tag = (Tag **)cext_array_attach((void **)tag, t, sizeof(Tag *), &tagsz);
ntag++;
+ if(!istag(ctag, nctag, name)) {
+ char buf[256];
+ ctag = (char **)cext_array_attach((void **)ctag, strdup(name),
+ sizeof(char *), &ctagsz);
+ nctag++;
+ snprintf(buf, sizeof(buf), "NewTag %s\n", name);
+ write_event(buf);
+ }
focus_tag(t);
return t;
}
@@ -160,7 +168,7 @@ get_tag(char *name)
}
cext_strlcpy(buf, name, sizeof(buf));
- nt = cext_tokenize(tags, 128, buf, ' ');
+ nt = cext_tokenize(tags, 128, buf, '+');
for(i = 0; i < nclient; i++)
for(j = 0; j < nt; j++)
if(strstr(client[i]->tags, tags[j]))
@@ -258,22 +266,22 @@ update_tags()
for(i = 0; i < nclient; i++)
for(j = 0; j < ntag; j++) {
- int level = 0;
+ Bool detach = False, attach = False;
cext_strlcpy(buf, tag[j]->name, sizeof(buf));
- nt = cext_tokenize(tags, 128, buf, ' ');
+ nt = cext_tokenize(tags, 128, buf, '+');
for(k = 0; k < nt; k++)
if(strstr(client[i]->tags, tags[k])) {
if(!clientoftag(tag[j], client[i]))
- level++;
+ attach = True;
}
else {
if(clientoftag(tag[j], client[i]))
- level--;
+ detach = True;
}
- if(level > 0)
+ if(attach)
attach_totag(tag[j], client[i]);
- else if(level < 0)
+ else if(detach)
detach_fromtag(tag[j], client[i]);
}