summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2014-10-08 15:31:01 +0000
committerokan <okan>2014-10-08 15:31:01 +0000
commit501aa2bcf364c2fbe29ede6ee8799aa4826a793c (patch)
tree8a0967e51d780b422f19761582c1346678bf8084
parentc700f7e19a1af8f488da3657c8c25d1eb8accd0a (diff)
parent9cada703b9772c5d9738c9bfa632e57678174025 (diff)
downloadcwm-501aa2bcf364c2fbe29ede6ee8799aa4826a793c.tar.gz
cwm-501aa2bcf364c2fbe29ede6ee8799aa4826a793c.tar.xz
cwm-501aa2bcf364c2fbe29ede6ee8799aa4826a793c.zip
cvsimport
-rw-r--r--calmwm.h4
-rw-r--r--group.c27
-rw-r--r--screen.c7
3 files changed, 20 insertions, 18 deletions
diff --git a/calmwm.h b/calmwm.h
index f6779a5..023c8f9 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -221,9 +221,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);
 
@@ -429,7 +429,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 e70acbb..93b253c 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 a7da3e9..f2b053e 100644
--- a/screen.c
+++ b/screen.c
@@ -38,7 +38,7 @@ screen_init(int which)
 	XSetWindowAttributes	 rootattr;
 	unsigned int		 nwins, i;
 
-	sc = xcalloc(1, sizeof(*sc));
+	sc = xmalloc(sizeof(*sc));
 
 	TAILQ_INIT(&sc->clientq);
 	TAILQ_INIT(&sc->regionq);
@@ -48,13 +48,16 @@ screen_init(int which)
 	sc->rootwin = RootWindow(X_Dpy, sc->which);
 	sc->cycling = 0;
 	sc->hideall = 0;
+
 	conf_screen(sc);
 
 	xu_ewmh_net_supported(sc);
 	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);