summary refs log tree commit diff
path: root/group.c
diff options
context:
space:
mode:
authorokan <okan>2015-08-25 19:49:19 +0000
committerokan <okan>2015-08-25 19:49:19 +0000
commitcb60a4b917a4e72cd579f1f7bc8d863be00498bb (patch)
treed84a1177969b9196468c65ab1ecf1d6c5b8d496f /group.c
parent96262a6b0cc6dbf5d82fcac45b81cbc376c2a0ef (diff)
downloadcwm-cb60a4b917a4e72cd579f1f7bc8d863be00498bb.tar.gz
cwm-cb60a4b917a4e72cd579f1f7bc8d863be00498bb.tar.xz
cwm-cb60a4b917a4e72cd579f1f7bc8d863be00498bb.zip
Allowing sending a valid 'nogroup' (0) group_ctx to group_assign()
(since we init all groups), though assigning the client's group to NULL
for 'sticky'; use this simplification in a few places (others to
follow).
Diffstat (limited to 'group.c')
-rw-r--r--group.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/group.c b/group.c
index fa7d8c9..30a6f53 100644
--- a/group.c
+++ b/group.c
@@ -48,6 +48,9 @@ group_assign(struct group_ctx *gc, struct client_ctx *cc)
 	if (cc->group != NULL)
 		TAILQ_REMOVE(&cc->group->clientq, cc, group_entry);
 
+	if ((gc != NULL) && (gc->num == 0))
+		gc = NULL;
+
 	cc->group = gc;
 
 	if (cc->group != NULL)
@@ -129,6 +132,8 @@ group_init(struct screen_ctx *sc, int num)
 	gc->num = num;
 	TAILQ_INIT(&gc->clientq);
 
+	fprintf(stderr, "%d: %s\n", gc->num, gc->name);
+
 	TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
 
 	if (num == 1)
@@ -338,7 +343,7 @@ group_restore(struct client_ctx *cc)
 	num = MIN(*grpnum, (CALMWM_NGROUPS - 1));
 	XFree(grpnum);
 
-	if ((num == -1) || (num == 0)) {
+	if (num == -1) {
 		group_assign(NULL, cc);
 		return(1);
 	}
@@ -373,10 +378,6 @@ group_autogroup(struct client_ctx *cc)
 		}
 	}
 
-	if (num == 0) {
-		group_assign(NULL, cc);
-		return(1);
-	}
 	TAILQ_FOREACH(gc, &sc->groupq, entry) {
 		if (gc->num == num) {
 			group_assign(gc, cc);