diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2014-10-08 12:48:52 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2014-10-08 12:48:52 +0000 |
commit | d07b14b74ce6fa98fae7867306d1c71d80473f14 (patch) | |
tree | 6710f72618f549722a5accf326cf2831298cc5f8 /app | |
parent | f2d7a20f5dbbef96b393f23ee1489a8252216f0b (diff) |
make group_init work like other *_init's
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.h | 6 | ||||
-rw-r--r-- | app/cwm/group.c | 29 | ||||
-rw-r--r-- | app/cwm/screen.c | 6 |
3 files changed, 21 insertions, 20 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 694a744b0..67b336c87 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.282 2014/09/27 19:04:32 okan Exp $ + * $OpenBSD: calmwm.h,v 1.283 2014/10/08 12:48:51 okan Exp $ */ #ifndef _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/app/cwm/group.c b/app/cwm/group.c index bbc3f3944..87c307d16 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.108 2014/09/27 19:04:32 okan Exp $ + * $OpenBSD: group.c,v 1.109 2014/10/08 12:48:51 okan Exp $ */ #include <sys/param.h> @@ -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/app/cwm/screen.c b/app/cwm/screen.c index 9fc01d356..42aa57247 100644 --- a/app/cwm/screen.c +++ b/app/cwm/screen.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: screen.c,v 1.68 2014/09/23 13:45:48 okan Exp $ + * $OpenBSD: screen.c,v 1.69 2014/10/08 12:48:51 okan Exp $ */ #include <sys/param.h> @@ -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); |