diff options
author | okan | 2014-09-01 18:04:58 +0000 |
---|---|---|
committer | okan | 2014-09-01 18:04:58 +0000 |
commit | 9012965b9e77a27dca052e625d516bef42b1515f (patch) | |
tree | 90c8000b14405b1533eaa39bd4e44603a28d092c /mousefunc.c | |
parent | 65f7d6fe84c11c78932bd9c10bce0ed3ded143c8 (diff) | |
download | cwm-9012965b9e77a27dca052e625d516bef42b1515f.tar.gz |
Merge group_menu into mousefunc_menu_group.
Diffstat (limited to 'mousefunc.c')
-rw-r--r-- | mousefunc.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/mousefunc.c b/mousefunc.c index 323ae29..7096e46 100644 --- a/mousefunc.c +++ b/mousefunc.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: mousefunc.c,v 1.73 2014/08/22 19:04:00 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.74 2014/09/01 18:04:58 okan Exp $ */ #include <sys/param.h> @@ -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 |