Merge group_menu into mousefunc_menu_group.

This commit is contained in:
okan
2014-09-01 18:04:58 +00:00
parent 3b99d53576
commit becc7f260c
3 changed files with 31 additions and 38 deletions

View File

@ -181,7 +181,31 @@ mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
void
mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
{
group_menu(cc->sc);
struct screen_ctx *sc = cc->sc;
struct group_ctx *gc;
struct menu *mi;
struct menu_q menuq;
TAILQ_INIT(&menuq);
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (TAILQ_EMPTY(&gc->clients))
continue;
menuq_add(&menuq, gc,
group_hidden_state(gc) ? "%d: [%s]" : "%d: %s",
gc->num, sc->group_names[gc->num]);
}
if (TAILQ_EMPTY(&menuq))
return;
mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
if (mi != NULL && mi->ctx != NULL) {
gc = (struct group_ctx *)mi->ctx;
(group_hidden_state(gc)) ?
group_show(sc, gc) : group_hide(sc, gc);
}
menuq_clear(&menuq);
}
void