summary refs log tree commit diff
path: root/group.c
diff options
context:
space:
mode:
authorokan <okan>2014-09-27 18:57:11 +0000
committerokan <okan>2014-09-27 18:57:11 +0000
commit319d90099d96e5f9d2b9b3ef182baf17a051a357 (patch)
treecb4c8685d64e9d70e0b4b5aa00121f9da0c54bc6 /group.c
parent845e82015ce9c1467f100a7f3d9c0310b00e353c (diff)
downloadcwm-319d90099d96e5f9d2b9b3ef182baf17a051a357.tar.gz
cwm-319d90099d96e5f9d2b9b3ef182baf17a051a357.tar.xz
cwm-319d90099d96e5f9d2b9b3ef182baf17a051a357.zip
Pass just the group to group_setactive instead of the screen and an
index which then needed to be found in a queue.
Diffstat (limited to 'group.c')
-rw-r--r--group.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/group.c b/group.c
index cabf854..6194e58 100644
--- a/group.c
+++ b/group.c
@@ -34,7 +34,7 @@
 
 static void		 group_assign(struct group_ctx *, struct client_ctx *);
 static void		 group_restack(struct group_ctx *);
-static void		 group_setactive(struct screen_ctx *, int);
+static void		 group_setactive(struct group_ctx *);
 
 const char *num_to_name[] = {
 	"nogroup", "one", "two", "three", "four", "five", "six",
@@ -75,7 +75,7 @@ group_show(struct group_ctx *gc)
 		client_unhide(cc);
 
 	group_restack(gc);
-	group_setactive(gc->sc, gc->num);
+	group_setactive(gc);
 }
 
 static void
@@ -126,20 +126,16 @@ group_init(struct screen_ctx *sc)
 		gc->name = xstrdup(num_to_name[i]);
 		gc->num = i;
 		TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
+		if (i == 1)
+			group_setactive(gc);
 	}
-
-	group_setactive(sc, 1);
 }
 
 static void
-group_setactive(struct screen_ctx *sc, int idx)
+group_setactive(struct group_ctx *gc)
 {
-	struct group_ctx	*gc;
+	struct screen_ctx	*sc = gc->sc;
 
-	TAILQ_FOREACH(gc, &sc->groupq, entry) {
-		if (gc->num == idx)
-			break;
-	}
 	sc->group_active = gc;
 
 	xu_ewmh_net_current_desktop(sc);
@@ -243,7 +239,7 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
 		group_hide(gc);
 		/* make clients stick to empty group */
 		if (TAILQ_EMPTY(&gc->clientq))
-			group_setactive(sc, idx);
+			group_setactive(gc);
 	}
 }
 
@@ -297,7 +293,7 @@ group_cycle(struct screen_ctx *sc, int flags)
 	if (group_holds_only_hidden(showgroup))
 		group_show(showgroup);
 	else
-		group_setactive(sc, showgroup->num);
+		group_setactive(showgroup);
 }
 
 void