summary refs log tree commit diff
path: root/group.c
diff options
context:
space:
mode:
authorokan <okan>2008-05-19 17:11:19 +0000
committerokan <okan>2008-05-19 17:11:19 +0000
commitd347aa3d9a1ad8fb01286c51027c411f83d06a9c (patch)
tree895dd6986c36d08a1578a542b417514dd5756d6d /group.c
parent43d6e147c2e0998f3e256fd2b90d85fd079429f4 (diff)
downloadcwm-d347aa3d9a1ad8fb01286c51027c411f83d06a9c.tar.gz
cwm-d347aa3d9a1ad8fb01286c51027c411f83d06a9c.tar.xz
cwm-d347aa3d9a1ad8fb01286c51027c411f83d06a9c.zip
as done with cycle/rcycle, make prev/next group switching one kbfuncs
and use a flag; adjusted to match and rename to {r,}cycle.

"ok, since i came up with the same thing" oga@
Diffstat (limited to 'group.c')
-rw-r--r--group.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/group.c b/group.c
index a75a319..616f30b 100644
--- a/group.c
+++ b/group.c
@@ -195,15 +195,11 @@ group_hidetoggle(int idx)
 	}
 }
 
-#define GROUP_NEXT(gc, fwd) (fwd) ?					\
-	TAILQ_NEXT(gc, entry) : TAILQ_PREV(gc, group_ctx_q, entry)
-
 /*
- * Jump to the next/previous active group.  If none exist, then just
- * stay put.
+ * Cycle through active groups.  If none exist, then just stay put.
  */
 void
-group_slide(int fwd)
+group_cycle(int reverse)
 {
 	struct group_ctx *gc, *showgroup = NULL;
 
@@ -211,10 +207,11 @@ group_slide(int fwd)
 
 	gc = Group_active;
 	for (;;) {
-		gc = GROUP_NEXT(gc, fwd);
+		gc = reverse ? TAILQ_PREV(gc, group_ctx_q, entry) :
+		    TAILQ_NEXT(gc, entry);
 		if (gc == NULL)
-			gc = fwd ? TAILQ_FIRST(&Groupq) :
-			    TAILQ_LAST(&Groupq, group_ctx_q);
+			gc = reverse ? TAILQ_LAST(&Groupq, group_ctx_q) :
+			    TAILQ_FIRST(&Groupq);
 		if (gc == Group_active)
 			break;