From 053c616a9b23d95f795db74c22314678cc9f6053 Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 7 Mar 2019 12:54:21 +0000 Subject: [PATCH] shuffle deck chairs: rename group actions to match intent for clarity --- app/cwm/calmwm.h | 8 ++++---- app/cwm/conf.c | 4 ++-- app/cwm/group.c | 36 ++++++++++++++++++------------------ app/cwm/kbfunc.c | 26 +++++++++++++------------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 83a373970..b1376d49f 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.368 2019/03/04 19:28:17 okan Exp $ + * $OpenBSD: calmwm.h,v 1.369 2019/03/07 12:54:21 okan Exp $ */ #ifndef _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/app/cwm/conf.c b/app/cwm/conf.c index 7812756f5..29b205364 100644 --- a/app/cwm/conf.c +++ b/app/cwm/conf.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: conf.c,v 1.248 2019/03/04 19:28:18 okan Exp $ + * $OpenBSD: conf.c,v 1.249 2019/03/07 12:54:21 okan Exp $ */ #include @@ -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/app/cwm/group.c b/app/cwm/group.c index 289c29466..3419c8b20 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.133 2019/03/01 14:32:01 okan Exp $ + * $OpenBSD: group.c,v 1.134 2019/03/07 12:54:21 okan Exp $ */ #include @@ -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/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index 2971f3bc3..9ae59f143 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.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: kbfunc.c,v 1.163 2019/03/04 19:28:18 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.164 2019/03/07 12:54:21 okan Exp $ */ #include @@ -427,18 +427,24 @@ kbfunc_client_movetogroup(void *ctx, struct cargs *cargs) group_movetogroup(ctx, cargs->flag); } -void -kbfunc_group_toggle(void *ctx, struct cargs *cargs) -{ - group_hidetoggle(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_toggle(ctx, cargs->flag); +} + +void +kbfunc_group_toggle_all(void *ctx, struct cargs *cargs) +{ + group_toggle_all(ctx); +} + void kbfunc_group_close(void *ctx, struct cargs *cargs) { @@ -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) {