summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calmwm.h10
-rw-r--r--conf.c8
-rw-r--r--cwm.16
-rw-r--r--group.c15
-rw-r--r--kbfunc.c10
5 files changed, 21 insertions, 28 deletions
diff --git a/calmwm.h b/calmwm.h
index ea16589..5ac1b8d 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -221,9 +221,12 @@ TAILQ_HEAD(winmatch_q, winmatch);
 /* for cwm_exec */
 #define	CWM_EXEC_PROGRAM	0x1
 #define	CWM_EXEC_WM		0x2
-/* For alt-tab */
+/* for alt-tab */
 #define CWM_CYCLE		0x0
 #define CWM_RCYCLE		0x1
+/* for group cycle */
+#define CWM_CYCLEGROUP		0x0
+#define CWM_RCYCLEGROUP		0x1
 
 #define KBFLAG_NEEDCLIENT 0x01
 
@@ -434,8 +437,7 @@ void			 kbfunc_cmdexec(struct client_ctx *, void *);
 void			 kbfunc_client_label(struct client_ctx *, void *);
 void			 kbfunc_client_delete(struct client_ctx *, void *);
 void			 kbfunc_client_group(struct client_ctx *, void *);
-void			 kbfunc_client_nextgroup(struct client_ctx *, void *);
-void			 kbfunc_client_prevgroup(struct client_ctx *, void *);
+void			 kbfunc_client_cyclegroup(struct client_ctx *, void *);
 void			 kbfunc_client_nogroup(struct client_ctx *, void *);
 void			 kbfunc_client_grouptoggle(struct client_ctx *, void *);
 void			 kbfunc_client_maximize(struct client_ctx *, void *);
@@ -463,7 +465,7 @@ void			 search_match_exec(struct menu_q *, struct menu_q *,
 
 void			 group_init(void);
 void			 group_hidetoggle(int);
-void			 group_slide(int);
+void			 group_cycle(int);
 void			 group_sticky(struct client_ctx *);
 void			 group_client_delete(struct client_ctx *);
 void			 group_menu(XButtonEvent *);
diff --git a/conf.c b/conf.c
index 9bf690f..eb3b404 100644
--- a/conf.c
+++ b/conf.c
@@ -115,8 +115,8 @@ conf_init(struct conf *c)
 	conf_bindname(c, "CM-7", "group7");
 	conf_bindname(c, "CM-8", "group8");
 	conf_bindname(c, "CM-9", "group9");
-	conf_bindname(c, "M-Right", "nextgroup");
-	conf_bindname(c, "M-Left", "prevgroup");
+	conf_bindname(c, "M-Right", "cyclegroup");
+	conf_bindname(c, "M-Left", "rcyclegroup");
 	conf_bindname(c, "CM-g", "grouptoggle");
 	conf_bindname(c, "CM-f", "maximize");
 	conf_bindname(c, "CM-equal", "vmaximize");
@@ -223,8 +223,8 @@ struct {
 	{ "group8", kbfunc_client_group, 0, (void *)8 },
 	{ "group9", kbfunc_client_group, 0, (void *)9 },
 	{ "nogroup", kbfunc_client_nogroup, 0, 0 },
-	{ "nextgroup", kbfunc_client_nextgroup, 0, 0 },
-	{ "prevgroup", kbfunc_client_prevgroup, 0, 0 },
+	{ "cyclegroup", kbfunc_client_cyclegroup, 0, (void *)CWM_CYCLEGROUP },
+	{ "rcyclegroup", kbfunc_client_cyclegroup, 0, (void *)CWM_RCYCLEGROUP },
 	{ "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, 0},
 	{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
 	{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
diff --git a/cwm.1 b/cwm.1
index 8c38f43..bd8648c 100644
--- a/cwm.1
+++ b/cwm.1
@@ -15,7 +15,7 @@
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
 .\" The following requests are required for all man pages.
-.Dd $Mdocdate: April 15 2008 $
+.Dd $Mdocdate: May 19 2008 $
 .Dt CWM 1
 .Os
 .Sh NAME
@@ -86,9 +86,9 @@ Select all groups.
 .It Ic C-M-g
 Toggle a window's membership in the current group.
 .It Ic M-Right
-Switch to next group.
+Cycle through active groups.
 .It Ic M-Left
-Switch to previous group.
+Reverse cycle through active groups.
 .It Ic C-M-f
 Toggle full-screen size of window.
 .It Ic C-M-=
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;
 
diff --git a/kbfunc.c b/kbfunc.c
index 11f2262..3f65650 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -412,15 +412,9 @@ kbfunc_client_group(struct client_ctx *cc, void *arg)
 }
 
 void
-kbfunc_client_nextgroup(struct client_ctx *cc, void *arg)
+kbfunc_client_cyclegroup(struct client_ctx *cc, void *arg)
 {
-	group_slide(1);
-}
-
-void
-kbfunc_client_prevgroup(struct client_ctx *cc, void *arg)
-{
-	group_slide(0);
+	group_cycle((int)arg);
 }
 
 void