repair groupcycle (broke after cycle-in-group support added more flags);

found by and fix from Thomas Pfaff.

ok oga@
This commit is contained in:
okan 2011-09-13 08:37:49 +00:00
parent 73c90e7628
commit 780e9cb0df

View File

@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $OpenBSD: group.c,v 1.51 2011/07/25 15:10:24 okan Exp $ * $OpenBSD: group.c,v 1.52 2011/09/13 08:37:49 okan Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -313,7 +313,7 @@ group_only(struct screen_ctx *sc, int idx)
* Cycle through active groups. If none exist, then just stay put. * Cycle through active groups. If none exist, then just stay put.
*/ */
void void
group_cycle(struct screen_ctx *sc, int reverse) group_cycle(struct screen_ctx *sc, int flags)
{ {
struct group_ctx *gc, *showgroup = NULL; struct group_ctx *gc, *showgroup = NULL;
@ -321,11 +321,11 @@ group_cycle(struct screen_ctx *sc, int reverse)
gc = sc->group_active; gc = sc->group_active;
for (;;) { for (;;) {
gc = reverse ? TAILQ_PREV(gc, group_ctx_q, entry) : gc = (flags & CWM_RCYCLE) ? TAILQ_PREV(gc, group_ctx_q,
TAILQ_NEXT(gc, entry); entry) : TAILQ_NEXT(gc, entry);
if (gc == NULL) if (gc == NULL)
gc = reverse ? TAILQ_LAST(&sc->groupq, group_ctx_q) : gc = (flags & CWM_RCYCLE) ? TAILQ_LAST(&sc->groupq,
TAILQ_FIRST(&sc->groupq); group_ctx_q) : TAILQ_FIRST(&sc->groupq);
if (gc == sc->group_active) if (gc == sc->group_active)
break; break;