use list functions for rules
This commit is contained in:
parent
572f409a29
commit
66507b0401
18
config.c
18
config.c
|
@ -738,8 +738,7 @@ config_parse(const char *confpatharg)
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
cfg_t *cfg, *cfg_rules, *cfg_keys, *cfg_mouse, *cfgsectmp;
|
cfg_t *cfg, *cfg_rules, *cfg_keys, *cfg_mouse, *cfgsectmp;
|
||||||
int ret, screen;
|
int ret, screen, i;
|
||||||
unsigned int i = 0;
|
|
||||||
const char *homedir;
|
const char *homedir;
|
||||||
char *confpath;
|
char *confpath;
|
||||||
ssize_t confpath_len;
|
ssize_t confpath_len;
|
||||||
|
@ -788,11 +787,10 @@ config_parse(const char *confpatharg)
|
||||||
cfg_mouse = cfg_getsec(cfg, "mouse");
|
cfg_mouse = cfg_getsec(cfg, "mouse");
|
||||||
|
|
||||||
/* Rules */
|
/* Rules */
|
||||||
if(cfg_size(cfg_rules, "rule"))
|
rule_list_init(&globalconf.rules);
|
||||||
{
|
for(i = cfg_size(cfg_rules, "rule") - 1; i >= 0; i--)
|
||||||
globalconf.rules = rule = p_new(Rule, 1);
|
|
||||||
for(i = 0; i < cfg_size(cfg_rules, "rule"); i++)
|
|
||||||
{
|
{
|
||||||
|
rule = p_new(Rule, 1);
|
||||||
cfgsectmp = cfg_getnsec(cfg_rules, "rule", i);
|
cfgsectmp = cfg_getnsec(cfg_rules, "rule", i);
|
||||||
rule->prop_r = rules_compile_regex(cfg_getstr(cfgsectmp, "name"));
|
rule->prop_r = rules_compile_regex(cfg_getstr(cfgsectmp, "name"));
|
||||||
rule->tags_r = rules_compile_regex(cfg_getstr(cfgsectmp, "tags"));
|
rule->tags_r = rules_compile_regex(cfg_getstr(cfgsectmp, "tags"));
|
||||||
|
@ -805,14 +803,8 @@ config_parse(const char *confpatharg)
|
||||||
if(rule->screen >= globalconf.nscreens)
|
if(rule->screen >= globalconf.nscreens)
|
||||||
rule->screen = 0;
|
rule->screen = 0;
|
||||||
|
|
||||||
if(i < cfg_size(cfg_rules, "rule") - 1)
|
rule_list_push(&globalconf.rules, rule);
|
||||||
rule = rule->next = p_new(Rule, 1);
|
|
||||||
else
|
|
||||||
rule->next = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
globalconf.rules = NULL;
|
|
||||||
|
|
||||||
/* Mouse: root window click bindings */
|
/* Mouse: root window click bindings */
|
||||||
globalconf.buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
globalconf.buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
||||||
|
|
3
config.h
3
config.h
|
@ -66,6 +66,8 @@ struct Rule
|
||||||
Rule *next;
|
Rule *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DO_SLIST(Rule, rule, p_delete);
|
||||||
|
|
||||||
typedef struct AwesomeConf AwesomeConf;
|
typedef struct AwesomeConf AwesomeConf;
|
||||||
|
|
||||||
typedef struct Key Key;
|
typedef struct Key Key;
|
||||||
|
@ -191,7 +193,6 @@ struct Client
|
||||||
Bool newcomer;
|
Bool newcomer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DO_SLIST(Client, client, p_delete);
|
DO_SLIST(Client, client, p_delete);
|
||||||
|
|
||||||
typedef struct FocusList FocusList;
|
typedef struct FocusList FocusList;
|
||||||
|
|
Loading…
Reference in New Issue