From 4ee9cdcd67e28703c3ef9b03c867618ced0ed413 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 16 Jan 2008 18:07:38 +0100 Subject: [PATCH] make tag_view_prev and next to by cycling --- tag.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tag.c b/tag.c index 2cba13a6..e4697c94 100644 --- a/tag.c +++ b/tag.c @@ -334,13 +334,15 @@ uicb_tag_prev_selected(int screen, char *arg __attribute__ ((unused))) void 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) - return; + if(curtags[0]->next) + tag = curtags[0]->next; + else + tag = globalconf.screens[screen].tags; curtags[0]->selected = False; - curtags[0]->next->selected = True; + tag->selected = True; p_delete(&curtags); @@ -360,16 +362,14 @@ uicb_tag_viewprev(int screen, char *arg __attribute__ ((unused))) { Tag *tag, **curtags = get_current_tags(screen); - for(tag = globalconf.screens[screen].tags; tag && tag->next != curtags[0]; tag = tag->next); - if(tag) - { - tag->selected = True; - curtags[0]->selected = False; - saveawesomeprops(screen); - arrange(screen); - } + tag = tag_list_prev_cycle(&globalconf.screens[screen].tags, curtags[0]); + + curtags[0]->selected = False; + tag->selected = True; + p_delete(&curtags); saveawesomeprops(screen); + arrange(screen); ewmh_update_net_current_desktop(get_phys_screen(screen)); widget_invalidate_cache(screen, WIDGET_CACHE_TAGS); }