make tag_view_prev and next to by cycling

This commit is contained in:
Julien Danjou 2008-01-16 18:07:38 +01:00
parent 4d117da0ec
commit 4ee9cdcd67
1 changed files with 12 additions and 12 deletions

24
tag.c
View File

@ -334,13 +334,15 @@ uicb_tag_prev_selected(int screen, char *arg __attribute__ ((unused)))
void void
uicb_tag_viewnext(int screen, char *arg __attribute__ ((unused))) uicb_tag_viewnext(int screen, char *arg __attribute__ ((unused)))
{ {
Tag **curtags = get_current_tags(screen); Tag *tag, **curtags = get_current_tags(screen);
if(!curtags[0]->next) if(curtags[0]->next)
return; tag = curtags[0]->next;
else
tag = globalconf.screens[screen].tags;
curtags[0]->selected = False; curtags[0]->selected = False;
curtags[0]->next->selected = True; tag->selected = True;
p_delete(&curtags); p_delete(&curtags);
@ -360,16 +362,14 @@ uicb_tag_viewprev(int screen, char *arg __attribute__ ((unused)))
{ {
Tag *tag, **curtags = get_current_tags(screen); Tag *tag, **curtags = get_current_tags(screen);
for(tag = globalconf.screens[screen].tags; tag && tag->next != curtags[0]; tag = tag->next); tag = tag_list_prev_cycle(&globalconf.screens[screen].tags, curtags[0]);
if(tag)
{ curtags[0]->selected = False;
tag->selected = True; tag->selected = True;
curtags[0]->selected = False;
saveawesomeprops(screen);
arrange(screen);
}
p_delete(&curtags); p_delete(&curtags);
saveawesomeprops(screen); saveawesomeprops(screen);
arrange(screen);
ewmh_update_net_current_desktop(get_phys_screen(screen)); ewmh_update_net_current_desktop(get_phys_screen(screen));
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS); widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
} }