mirror of
https://github.com/0intro/wmii
synced 2024-11-25 23:30:24 +03:00
fixed update_tags, hopefully
This commit is contained in:
parent
3c5dd59018
commit
1cfea0d215
22
cmd/wm/tag.c
22
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]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user