change Layout linked list to by cycling
This commit is contained in:
parent
53f3a4aca7
commit
34309baa60
10
config.c
10
config.c
|
@ -395,6 +395,7 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
/* Layouts */
|
||||
virtscreen->layouts = layout = p_new(Layout, 1);
|
||||
if(cfg_size(cfg_layouts, "layout"))
|
||||
{
|
||||
for(i = 0; i < cfg_size(cfg_layouts, "layout"); i++)
|
||||
{
|
||||
cfgsectmp = cfg_getnsec(cfg_layouts, "layout", i);
|
||||
|
@ -408,7 +409,14 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
layout->image = a_strdup(cfg_getstr(cfgsectmp, "image"));
|
||||
|
||||
if(i < cfg_size(cfg_layouts, "layout") - 1)
|
||||
layout = layout->next = p_new(Layout, 1);
|
||||
{
|
||||
layout->next = p_new(Layout, 1);
|
||||
layout->next->prev = layout;
|
||||
layout = layout->next;
|
||||
}
|
||||
}
|
||||
/* do cycling */
|
||||
virtscreen->layouts->prev = layout;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
12
layout.c
12
layout.c
|
@ -243,11 +243,19 @@ uicb_tag_setlayout(int screen, char *arg)
|
|||
curtags = get_current_tags(screen);
|
||||
for(i = 0; l && l != curtags[0]->layout; i++, l = l->next);
|
||||
p_delete(&curtags);
|
||||
|
||||
if(!l)
|
||||
i = 0;
|
||||
for(i = compute_new_value_from_arg(arg, (double) i),
|
||||
l = globalconf.screens[screen].layouts; l && i > 0; i--)
|
||||
|
||||
i = compute_new_value_from_arg(arg, (double) i);
|
||||
|
||||
if(i >= 0)
|
||||
for(l = globalconf.screens[screen].layouts; l && i > 0; i--)
|
||||
l = l->next;
|
||||
else
|
||||
for(l = globalconf.screens[screen].layouts; l && i < 0; i++)
|
||||
l = l->prev;
|
||||
|
||||
if(!l)
|
||||
l = globalconf.screens[screen].layouts;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue