mirror of
https://github.com/0intro/wmii
synced 2024-11-22 22:02:30 +03:00
I recently worked on allowing 'select tag(s)', but not finished yet
This commit is contained in:
parent
ae9064ab09
commit
3eea13a29b
22
cmd/wm/tag.c
22
cmd/wm/tag.c
@ -148,27 +148,35 @@ istag(char **tags, char *tag, unsigned int ntags)
|
||||
Tag *
|
||||
get_tag(char *name)
|
||||
{
|
||||
unsigned int i, n = 0;
|
||||
unsigned int i, n = 0, j, nt;
|
||||
Tag *t;
|
||||
char buf[256];
|
||||
char *tags[128];
|
||||
|
||||
if(!istag(ctag, name, nctag))
|
||||
return nil;
|
||||
for(i = 0; i < ntag; i++) {
|
||||
t = tag[i];
|
||||
if(!strncmp(t->name, name, strlen(t->name)))
|
||||
return t;
|
||||
}
|
||||
|
||||
cext_strlcpy(buf, name, sizeof(buf));
|
||||
nt = cext_tokenize(tags, 128, buf, ' ');
|
||||
|
||||
for(i = 0; i < nclient; i++)
|
||||
if(strstr(client[i]->tags, name))
|
||||
n++;
|
||||
for(j = 0; j < nt; j++)
|
||||
if(strstr(client[i]->tags, tags[j]))
|
||||
n++;
|
||||
|
||||
fprintf(stderr, "get_tag %d\n", n);
|
||||
if(!n)
|
||||
return nil;
|
||||
|
||||
t = alloc_tag(name);
|
||||
for(i = 0; i < nclient; i++)
|
||||
if(strstr(client[i]->tags, name))
|
||||
attach_totag(t, client[i]);
|
||||
for(j = 0; j < nt; j++)
|
||||
if(strstr(client[i]->tags, tags[j]))
|
||||
if(!clientoftag(t, client[i]))
|
||||
attach_totag(t, client[i]);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ cext_tokenize(char **result, unsigned int reslen, char *str, char delim)
|
||||
} else
|
||||
n++;
|
||||
}
|
||||
if(strlen(p))
|
||||
if((i < reslen) && (p < n) && strlen(p))
|
||||
result[i++] = p;
|
||||
return i; /* number of tokens */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user