use list functions for Button
This commit is contained in:
parent
b08c343b65
commit
19887a3201
19
config.c
19
config.c
|
@ -146,19 +146,17 @@ mouse_button_lookup(const char *button)
|
||||||
static Button *
|
static Button *
|
||||||
parse_mouse_bindings(cfg_t * cfg, const char *secname, Bool handle_arg)
|
parse_mouse_bindings(cfg_t * cfg, const char *secname, Bool handle_arg)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
int i, j;
|
||||||
cfg_t *cfgsectmp;
|
cfg_t *cfgsectmp;
|
||||||
Button *b = NULL, *head = NULL;
|
Button *b = NULL, *head = NULL;
|
||||||
|
|
||||||
/* Mouse: layout click bindings */
|
/* Mouse: layout click bindings */
|
||||||
for(i = 0; i < cfg_size(cfg, secname); i++)
|
for(i = cfg_size(cfg, secname) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
/* init first elem */
|
b = p_new(Button, 1);
|
||||||
if(i == 0)
|
|
||||||
head = b = p_new(Button, 1);
|
|
||||||
|
|
||||||
cfgsectmp = cfg_getnsec(cfg, secname, i);
|
cfgsectmp = cfg_getnsec(cfg, secname, i);
|
||||||
for(j = 0; j < cfg_size(cfgsectmp, "modkey"); j++)
|
for(j = cfg_size(cfgsectmp, "modkey") - 1; j >= 0; j--)
|
||||||
b->mod |= key_mask_lookup(cfg_getnstr(cfgsectmp, "modkey", j));
|
b->mod |= key_mask_lookup(cfg_getnstr(cfgsectmp, "modkey", j));
|
||||||
b->button = mouse_button_lookup(cfg_getstr(cfgsectmp, "button"));
|
b->button = mouse_button_lookup(cfg_getstr(cfgsectmp, "button"));
|
||||||
b->func = name_func_lookup(cfg_getstr(cfgsectmp, "command"), UicbList);
|
b->func = name_func_lookup(cfg_getstr(cfgsectmp, "command"), UicbList);
|
||||||
|
@ -169,14 +167,7 @@ parse_mouse_bindings(cfg_t * cfg, const char *secname, Bool handle_arg)
|
||||||
else
|
else
|
||||||
b->arg = NULL;
|
b->arg = NULL;
|
||||||
|
|
||||||
/* switch to next elem or finalize the list */
|
button_list_push(&head, b);
|
||||||
if(i < cfg_size(cfg, secname) - 1)
|
|
||||||
{
|
|
||||||
b->next = p_new(Button, 1);
|
|
||||||
b = b->next;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
b->next = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return head;
|
return head;
|
||||||
|
|
Loading…
Reference in New Issue