summaryrefslogtreecommitdiff
path: root/app/cwm/group.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2015-08-25 19:49:20 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2015-08-25 19:49:20 +0000
commit855868949d09f2921c184ee2af19382c3cc208fe (patch)
tree5f53ceedb66d2db6af413648592a51ba227ba848 /app/cwm/group.c
parent9e7780805c8fad5905d6ad8ff5e90873ed6a693f (diff)
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 'app/cwm/group.c')
-rw-r--r--app/cwm/group.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/cwm/group.c b/app/cwm/group.c
index 593a0d6c9..19b5963e9 100644
--- a/app/cwm/group.c
+++ b/app/cwm/group.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: group.c,v 1.115 2015/08/25 18:29:10 okan Exp $
+ * $OpenBSD: group.c,v 1.116 2015/08/25 19:49:19 okan Exp $
*/
#include <sys/types.h>
@@ -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);