From b26202724a342b596692b5e9b1f47c7c491a1934 Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 7 Mar 2019 12:54:21 +0000 Subject: shuffle deck chairs: rename group actions to match intent for clarity --- calmwm.h | 6 +++--- conf.c | 2 +- group.c | 34 +++++++++++++++++----------------- kbfunc.c | 18 +++++++++--------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/calmwm.h b/calmwm.h index 939f946..14ef4f4 100644 --- a/calmwm.h +++ b/calmwm.h @@ -436,12 +436,10 @@ void client_urgency(struct client_ctx *); void client_vtile(struct client_ctx *); void client_wm_hints(struct client_ctx *); -void group_alltoggle(struct screen_ctx *); void group_assign(struct group_ctx *, struct client_ctx *); int group_autogroup(struct client_ctx *); void group_cycle(struct screen_ctx *, int); 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 *, int, const char *); @@ -450,6 +448,8 @@ void group_only(struct screen_ctx *, int); void group_close(struct screen_ctx *, int); int group_restore(struct client_ctx *); void group_show(struct group_ctx *); +void group_toggle(struct screen_ctx *, int); +void group_toggle_all(struct screen_ctx *); void group_toggle_membership(struct client_ctx *); void group_update_names(struct screen_ctx *); @@ -513,7 +513,7 @@ void kbfunc_group_toggle(void *, struct cargs *); void kbfunc_group_only(void *, struct cargs *); void kbfunc_group_close(void *, struct cargs *); void kbfunc_group_cycle(void *, struct cargs *); -void kbfunc_group_alltoggle(void *, struct cargs *); +void kbfunc_group_toggle_all(void *, struct cargs *); void kbfunc_menu_client(void *, struct cargs *); void kbfunc_menu_cmd(void *, struct cargs *); void kbfunc_menu_group(void *, struct cargs *); diff --git a/conf.c b/conf.c index 30c803e..d25e00f 100644 --- a/conf.c +++ b/conf.c @@ -139,7 +139,7 @@ static const struct { { FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) }, { FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) }, - { FUNC_SC(group-toggle-all, group_alltoggle, 0) }, + { FUNC_SC(group-toggle-all, group_toggle_all, 0) }, { FUNC_SC(group-toggle-1, group_toggle, 1) }, { FUNC_SC(group-toggle-2, group_toggle, 2) }, { FUNC_SC(group-toggle-3, group_toggle, 3) }, diff --git a/group.c b/group.c index eee916f..c1788eb 100644 --- a/group.c +++ b/group.c @@ -204,7 +204,20 @@ group_holds_only_hidden(struct group_ctx *gc) } void -group_hidetoggle(struct screen_ctx *sc, int idx) +group_only(struct screen_ctx *sc, int idx) +{ + struct group_ctx *gc; + + TAILQ_FOREACH(gc, &sc->groupq, entry) { + if (gc->num == idx) + group_show(gc); + else + group_hide(gc); + } +} + +void +group_toggle(struct screen_ctx *sc, int idx) { struct group_ctx *gc; @@ -223,16 +236,17 @@ group_hidetoggle(struct screen_ctx *sc, int idx) } void -group_only(struct screen_ctx *sc, int idx) +group_toggle_all(struct screen_ctx *sc) { struct group_ctx *gc; TAILQ_FOREACH(gc, &sc->groupq, entry) { - if (gc->num == idx) + if (sc->hideall) group_show(gc); else group_hide(gc); } + sc->hideall = !sc->hideall; } void @@ -301,20 +315,6 @@ group_prev(struct group_ctx *gc) newgc : TAILQ_LAST(&sc->groupq, group_q)); } -void -group_alltoggle(struct screen_ctx *sc) -{ - struct group_ctx *gc; - - TAILQ_FOREACH(gc, &sc->groupq, entry) { - if (sc->hideall) - group_show(gc); - else - group_hide(gc); - } - sc->hideall = !sc->hideall; -} - int group_restore(struct client_ctx *cc) { diff --git a/kbfunc.c b/kbfunc.c index 1858a42..5f6d54e 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -427,16 +427,22 @@ kbfunc_client_movetogroup(void *ctx, struct cargs *cargs) group_movetogroup(ctx, cargs->flag); } +void +kbfunc_group_only(void *ctx, struct cargs *cargs) +{ + group_only(ctx, cargs->flag); +} + void kbfunc_group_toggle(void *ctx, struct cargs *cargs) { - group_hidetoggle(ctx, cargs->flag); + group_toggle(ctx, cargs->flag); } void -kbfunc_group_only(void *ctx, struct cargs *cargs) +kbfunc_group_toggle_all(void *ctx, struct cargs *cargs) { - group_only(ctx, cargs->flag); + group_toggle_all(ctx); } void @@ -451,12 +457,6 @@ kbfunc_group_cycle(void *ctx, struct cargs *cargs) group_cycle(ctx, cargs->flag); } -void -kbfunc_group_alltoggle(void *ctx, struct cargs *cargs) -{ - group_alltoggle(ctx); -} - void kbfunc_menu_client(void *ctx, struct cargs *cargs) { -- cgit 1.4.1