mirror of
https://github.com/0intro/wmii
synced 2025-01-06 02:22:01 +03:00
simplified rule.c
This commit is contained in:
parent
3588e0909d
commit
2b3eb084f7
@ -336,11 +336,9 @@ manage_client(Client *c)
|
||||
{
|
||||
View *v;
|
||||
Client *trans;
|
||||
unsigned int i;
|
||||
|
||||
if(c->trans && (trans = win2client(c->trans))) {
|
||||
for(i = 0; i < trans->ntag; i++)
|
||||
cext_strlcpy(c->tags, trans->tags, sizeof(c->tags));
|
||||
cext_strlcpy(c->tags, trans->tags, sizeof(c->tags));
|
||||
str2tagvector(&c->tag, c->tags);
|
||||
}
|
||||
else
|
||||
@ -349,7 +347,7 @@ manage_client(Client *c)
|
||||
reparent_client(c, c->framewin, c->rect.x, c->rect.y);
|
||||
|
||||
v = view.size ? view.data[sel] : alloc_view(def.tag);
|
||||
if(!c->ntag) {
|
||||
if(!strlen(c->tags)) {
|
||||
cext_strlcpy(c->tags, v->name, sizeof(c->tags));
|
||||
str2tagvector(&c->tag, c->tags);
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ rule2vector(RuleVector *rv)
|
||||
void
|
||||
update_rules()
|
||||
{
|
||||
unsigned int i;
|
||||
int mode = IGNORE;
|
||||
char *p, *r = nil, *t = nil, regex[256], tags[256];
|
||||
|
||||
@ -49,14 +48,13 @@ update_rules()
|
||||
return;
|
||||
|
||||
while(rule.size) {
|
||||
Rule *r = rule.data[i];
|
||||
Rule *r = rule.data[0];
|
||||
if(r->is_valid)
|
||||
regfree(&r->regex);
|
||||
cext_vdetach(rule2vector(&rule), r);
|
||||
free(r);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for(p = def.rules; *p; p++)
|
||||
switch(mode) {
|
||||
case IGNORE:
|
||||
@ -106,14 +104,15 @@ match(Client *c, const char *prop)
|
||||
unsigned int i;
|
||||
regmatch_t tmpregm;
|
||||
|
||||
c->tags[0] = 0;
|
||||
for(i = 0; i < rule.size; i++) {
|
||||
Rule *r = rule.data[i];
|
||||
if(r->is_valid && !regexec(&r->regex, prop, 1, &tmpregm, 0)) {
|
||||
if(!strncmp(r->tags, "~", 2))
|
||||
c->floating = True;
|
||||
else
|
||||
cext_strlcat(c->tags, r->tags, sizeof(c->tags) - strlen(c->tags));
|
||||
else {
|
||||
cext_strlcpy(c->tags, r->tags, sizeof(c->tags));
|
||||
str2tagvector(&c->tag, c->tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ void
|
||||
update_tags()
|
||||
{
|
||||
unsigned int i, j;
|
||||
for(i = 0; i < tag.size; i++) {
|
||||
free(tag.data[i]);
|
||||
tag.data[i] = nil;
|
||||
while(tag.size) {
|
||||
char *p = tag.data[0];
|
||||
cext_vdetach(tag2vector(&tag), p);
|
||||
free(p);
|
||||
}
|
||||
tag.size = 0;
|
||||
|
||||
for(i = 0; i < client.size; i++) {
|
||||
for(j = 0; j < client.data[i]->tag.size; j++)
|
||||
|
@ -103,7 +103,6 @@ struct Client {
|
||||
char name[256];
|
||||
char tags[256];
|
||||
TagVector tag;
|
||||
unsigned int ntag;
|
||||
char classinst[256];
|
||||
int proto;
|
||||
unsigned int border;
|
||||
|
Loading…
Reference in New Issue
Block a user