diff --git a/awesome.c b/awesome.c index d26b02c6..2ca8d12f 100644 --- a/awesome.c +++ b/awesome.c @@ -197,8 +197,6 @@ setup(awesome_config *awesomeconf) grabkeys(awesomeconf->display, awesomeconf->phys_screen, awesomeconf); - compileregs(awesomeconf->rules, awesomeconf->nrules); - /* bar */ initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, awesomeconf->cursor[CurNormal], awesomeconf->font, awesomeconf->layouts, awesomeconf->nlayouts); } diff --git a/config.c b/config.c index d795c5a8..5ff7bee6 100644 --- a/config.c +++ b/config.c @@ -342,6 +342,8 @@ parse_config(Display * disp, int scr,const char *confpatharg, awesome_config *aw awesomeconf->rules[i].isfloating = cfg_getbool(cfgsectmp, "float"); } + compileregs(awesomeconf->rules, awesomeconf->nrules); + /* Tags */ awesomeconf->ntags = cfg_size(cfg_tags, "tag"); diff --git a/config.h b/config.h index 6ef52f60..755f4f1e 100644 --- a/config.h +++ b/config.h @@ -24,6 +24,7 @@ #include #include +#include /** Bar possible position */ enum @@ -40,6 +41,8 @@ typedef struct char *prop; char *tags; Bool isfloating; + regex_t *propregex; + regex_t *tagregex; } Rule; typedef struct awesome_config awesome_config; diff --git a/tag.c b/tag.c index 629ecb32..df651d1f 100644 --- a/tag.c +++ b/tag.c @@ -26,14 +26,6 @@ #include "tag.h" #include "util.h" -typedef struct -{ - regex_t *propregex; - regex_t *tagregex; -} Regs; - -static Regs *regs = NULL; - /** This function returns the index of * the tag given un argument in *tags * \param tag_to_find tag name @@ -75,11 +67,11 @@ applyrules(Client * c, awesome_config *awesomeconf) snprintf(prop, len + 3, "%s:%s:%s", ch.res_class ? ch.res_class : "", ch.res_name ? ch.res_name : "", c->name); for(i = 0; i < awesomeconf->nrules; i++) - if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) + if(awesomeconf->rules[i].propregex && !regexec(awesomeconf->rules[i].propregex, prop, 1, &tmp, 0)) { c->isfloating = awesomeconf->rules[i].isfloating; - for(j = 0; regs[i].tagregex && j < awesomeconf->ntags; j++) - if(!regexec(regs[i].tagregex, awesomeconf->tags[j].name, 1, &tmp, 0)) + for(j = 0; awesomeconf->rules[i].tagregex && j < awesomeconf->ntags; j++) + if(!regexec(awesomeconf->rules[i].tagregex, awesomeconf->tags[j].name, 1, &tmp, 0)) { matched = True; c->tags[j] = True; @@ -103,9 +95,6 @@ compileregs(Rule * rules, int nrules) int i; regex_t *reg; - if(regs) - return; - regs = p_new(Regs, nrules); for(i = 0; i < nrules; i++) { if(rules[i].prop) @@ -114,7 +103,7 @@ compileregs(Rule * rules, int nrules) if(regcomp(reg, rules[i].prop, REG_EXTENDED)) p_delete(®); else - regs[i].propregex = reg; + rules[i].propregex = reg; } if(rules[i].tags) { @@ -122,7 +111,7 @@ compileregs(Rule * rules, int nrules) if(regcomp(reg, rules[i].tags, REG_EXTENDED)) p_delete(®); else - regs[i].tagregex = reg; + rules[i].tagregex = reg; } } } diff --git a/tag.h b/tag.h index 7adb902e..f0ff9920 100644 --- a/tag.h +++ b/tag.h @@ -22,7 +22,6 @@ #ifndef AWESOME_TAG_H #define AWESOME_TAG_H -#include #include "client.h" /** Check if a client is tiled */