summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/client.c b/client.c
index a55bd42..7a0fbc6 100644
--- a/client.c
+++ b/client.c
@@ -567,7 +567,7 @@ match:
 }
 
 void
-client_cycle(struct screen_ctx *sc, int reverse)
+client_cycle(struct screen_ctx *sc, int flags)
 {
 	struct client_ctx	*oldcc, *newcc;
 	int			 again = 1;
@@ -579,18 +579,19 @@ client_cycle(struct screen_ctx *sc, int reverse)
 		return;
 
 	if (oldcc == NULL)
-		oldcc = (reverse ? TAILQ_LAST(&sc->mruq, cycle_entry_q) :
+		oldcc = (flags & CWM_RCYCLE ? TAILQ_LAST(&sc->mruq, cycle_entry_q) :
 		    TAILQ_FIRST(&sc->mruq));
 
 	newcc = oldcc;
 	while (again) {
 		again = 0;
 
-		newcc = (reverse ? client_mruprev(newcc) :
+		newcc = (flags & CWM_RCYCLE ? client_mruprev(newcc) :
 		    client_mrunext(newcc));
 
 		/* Only cycle visible and non-ignored windows. */
-		if (newcc->flags & (CLIENT_HIDDEN|CLIENT_IGNORE))
+		if ((newcc->flags & (CLIENT_HIDDEN|CLIENT_IGNORE))
+			|| ((flags & CWM_INGROUP) && (newcc->group != oldcc->group)))
 			again = 1;
 
 		/* Is oldcc the only non-hidden window? */