use list functions for rules
This commit is contained in:
parent
572f409a29
commit
66507b0401
40
config.c
40
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,31 +787,24 @@ 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);
|
rule = p_new(Rule, 1);
|
||||||
for(i = 0; i < cfg_size(cfg_rules, "rule"); i++)
|
cfgsectmp = cfg_getnsec(cfg_rules, "rule", i);
|
||||||
{
|
rule->prop_r = rules_compile_regex(cfg_getstr(cfgsectmp, "name"));
|
||||||
cfgsectmp = cfg_getnsec(cfg_rules, "rule", i);
|
rule->tags_r = rules_compile_regex(cfg_getstr(cfgsectmp, "tags"));
|
||||||
rule->prop_r = rules_compile_regex(cfg_getstr(cfgsectmp, "name"));
|
rule->xprop = a_strdup(cfg_getstr(cfgsectmp, "xproperty_name"));
|
||||||
rule->tags_r = rules_compile_regex(cfg_getstr(cfgsectmp, "tags"));
|
rule->xpropval_r = rules_compile_regex(cfg_getstr(cfgsectmp, "xproperty_value"));
|
||||||
rule->xprop = a_strdup(cfg_getstr(cfgsectmp, "xproperty_name"));
|
rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon"));
|
||||||
rule->xpropval_r = rules_compile_regex(cfg_getstr(cfgsectmp, "xproperty_value"));
|
rule->isfloating = rules_get_float_from_str(cfg_getstr(cfgsectmp, "float"));
|
||||||
rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon"));
|
rule->screen = cfg_getint(cfgsectmp, "screen");
|
||||||
rule->isfloating = rules_get_float_from_str(cfg_getstr(cfgsectmp, "float"));
|
rule->not_master = cfg_getbool(cfgsectmp, "not_master");
|
||||||
rule->screen = cfg_getint(cfgsectmp, "screen");
|
if(rule->screen >= globalconf.nscreens)
|
||||||
rule->not_master = cfg_getbool(cfgsectmp, "not_master");
|
rule->screen = 0;
|
||||||
if(rule->screen >= globalconf.nscreens)
|
|
||||||
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