summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2014-10-08 12:48:51 +0000
committerokan <okan>2014-10-08 12:48:51 +0000
commit836c9f49d644e52395a12d0805260e070c999099 (patch)
tree439aa78537067b62302252c3c01c1edf24f4beb2
parente9dbd150eaf14d230e7aa6191e5762b69e6b1241 (diff)
downloadcwm-836c9f49d644e52395a12d0805260e070c999099.tar.gz
cwm-836c9f49d644e52395a12d0805260e070c999099.tar.xz
cwm-836c9f49d644e52395a12d0805260e070c999099.zip
make group_init work like other *_init's
-rw-r--r--calmwm.h4
-rw-r--r--group.c27
-rw-r--r--screen.c4
3 files changed, 18 insertions, 17 deletions
diff --git a/calmwm.h b/calmwm.h
index 00d09bb..80e2554 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -202,9 +202,9 @@ TAILQ_HEAD(client_ctx_q, client_ctx);
 struct group_ctx {
 	TAILQ_ENTRY(group_ctx)	 entry;
 	struct screen_ctx	*sc;
-	struct client_ctx_q	 clientq;
 	char			*name;
 	int			 num;
+	struct client_ctx_q	 clientq;
 };
 TAILQ_HEAD(group_ctx_q, group_ctx);
 
@@ -410,7 +410,7 @@ void			 group_hide(struct group_ctx *);
 void			 group_hidetoggle(struct screen_ctx *, int);
 int			 group_holds_only_hidden(struct group_ctx *);
 int			 group_holds_only_sticky(struct group_ctx *);
-void			 group_init(struct screen_ctx *);
+void			 group_init(struct screen_ctx *, int);
 void			 group_movetogroup(struct client_ctx *, int);
 void			 group_only(struct screen_ctx *, int);
 void			 group_show(struct group_ctx *);
diff --git a/group.c b/group.c
index c7933f0..50fb82c 100644
--- a/group.c
+++ b/group.c
@@ -114,24 +114,23 @@ group_restack(struct group_ctx *gc)
 }
 
 void
-group_init(struct screen_ctx *sc)
+group_init(struct screen_ctx *sc, int num)
 {
 	struct group_ctx	*gc;
-	int			 i;
-
-	for (i = 0; i < CALMWM_NGROUPS; i++) {
-		gc = xcalloc(1, sizeof(*gc));
-		gc->sc = sc;
-		TAILQ_INIT(&gc->clientq);
-		gc->name = xstrdup(num_to_name[i]);
-		gc->num = i;
-		TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
-		if (i == 1)
-			group_setactive(gc);
-	}
+
+	gc = xmalloc(sizeof(*gc));
+	gc->sc = sc;
+	gc->name = xstrdup(num_to_name[num]);
+	gc->num = num;
+	TAILQ_INIT(&gc->clientq);
+
+	TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
+
+	if (num == 1)
+		group_setactive(gc);
 }
 
-static void
+void
 group_setactive(struct group_ctx *gc)
 {
 	struct screen_ctx	*sc = gc->sc;
diff --git a/screen.c b/screen.c
index 9beabb2..f9a4ca8 100644
--- a/screen.c
+++ b/screen.c
@@ -54,7 +54,9 @@ screen_init(int which)
 	xu_ewmh_net_supported_wm_check(sc);
 
 	screen_update_geometry(sc);
-	group_init(sc);
+
+	for (i = 0; i < CALMWM_NGROUPS; i++)
+		group_init(sc, i);
 
 	xu_ewmh_net_desktop_names(sc);
 	xu_ewmh_net_wm_desktop_viewport(sc);