mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Merge group_menu into mousefunc_menu_group.
This commit is contained in:
parent
3b99d53576
commit
becc7f260c
4
calmwm.h
4
calmwm.h
@ -410,11 +410,13 @@ void client_wm_hints(struct client_ctx *);
|
||||
void group_alltoggle(struct screen_ctx *);
|
||||
void group_autogroup(struct client_ctx *);
|
||||
void group_cycle(struct screen_ctx *, int);
|
||||
int group_hidden_state(struct group_ctx *);
|
||||
void group_hide(struct screen_ctx *, struct group_ctx *);
|
||||
void group_hidetoggle(struct screen_ctx *, int);
|
||||
void group_init(struct screen_ctx *);
|
||||
void group_menu(struct screen_ctx *);
|
||||
void group_movetogroup(struct client_ctx *, int);
|
||||
void group_only(struct screen_ctx *, int);
|
||||
void group_show(struct screen_ctx *, struct group_ctx *);
|
||||
void group_sticky(struct client_ctx *);
|
||||
void group_sticky_toggle_enter(struct client_ctx *);
|
||||
void group_sticky_toggle_exit(struct client_ctx *);
|
||||
|
39
group.c
39
group.c
@ -33,10 +33,7 @@
|
||||
#include "calmwm.h"
|
||||
|
||||
static void group_assign(struct group_ctx *, struct client_ctx *);
|
||||
static void group_hide(struct screen_ctx *, struct group_ctx *);
|
||||
static void group_show(struct screen_ctx *, struct group_ctx *);
|
||||
static void group_restack(struct screen_ctx *, struct group_ctx *);
|
||||
static int group_hidden_state(struct group_ctx *);
|
||||
static void group_setactive(struct screen_ctx *, long);
|
||||
|
||||
const char *num_to_name[] = {
|
||||
@ -58,7 +55,7 @@ group_assign(struct group_ctx *gc, struct client_ctx *cc)
|
||||
xu_ewmh_net_wm_desktop(cc);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
group_hide(struct screen_ctx *sc, struct group_ctx *gc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
@ -69,7 +66,7 @@ group_hide(struct screen_ctx *sc, struct group_ctx *gc)
|
||||
client_hide(cc);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
@ -199,7 +196,7 @@ group_sticky_toggle_exit(struct client_ctx *cc)
|
||||
/*
|
||||
* If all clients in a group are hidden, then the group state is hidden.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
group_hidden_state(struct group_ctx *gc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
@ -291,36 +288,6 @@ group_cycle(struct screen_ctx *sc, int flags)
|
||||
group_setactive(sc, showgroup->num);
|
||||
}
|
||||
|
||||
void
|
||||
group_menu(struct screen_ctx *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
|
||||
group_alltoggle(struct screen_ctx *sc)
|
||||
{
|
||||
|
26
mousefunc.c
26
mousefunc.c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user