From b1c2046efd856c4d32ba1a50a83e8b651f1769bd Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 21 May 2015 00:37:04 +0000 Subject: merge kbd and mouse grouptoggle --- mousefunc.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'mousefunc.c') diff --git a/mousefunc.c b/mousefunc.c index 14138a6..271e732 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -172,12 +172,6 @@ mousefunc_client_move(struct client_ctx *cc, union arg *arg) /* NOTREACHED */ } -void -mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg) -{ - group_toggle_membership_enter(cc); -} - void mousefunc_menu_group(struct client_ctx *cc, union arg *arg) { -- cgit 1.4.1 From a4cba7e113490fdf691ccc52a1cae6629cdf97b4 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 5 Jun 2015 15:01:51 +0000 Subject: add a flag to indicate a menu list instead of overloading 'prompt' --- calmwm.h | 1 + menu.c | 4 +++- mousefunc.c | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'mousefunc.c') diff --git a/calmwm.h b/calmwm.h index 3b297b0..69b8a9d 100644 --- a/calmwm.h +++ b/calmwm.h @@ -73,6 +73,7 @@ /* menu */ #define CWM_MENU_DUMMY 0x0001 #define CWM_MENU_FILE 0x0002 +#define CWM_MENU_LIST 0x0004 #define ARG_CHAR 0x0001 #define ARG_INT 0x0002 diff --git a/menu.c b/menu.c index f9a0354..37515bd 100644 --- a/menu.c +++ b/menu.c @@ -109,9 +109,11 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt, mc.hasprompt = 1; } else { evmask = MENUMASK; - mc.list = 1; } + if (mc.flags & CWM_MENU_LIST) + mc.list = 1; + if (initial != NULL) (void)strlcpy(mc.searchstr, initial, sizeof(mc.searchstr)); else diff --git a/mousefunc.c b/mousefunc.c index 271e732..a1d7e06 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -191,7 +191,7 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg) if (TAILQ_EMPTY(&menuq)) return; - if ((mi = menu_filter(sc, &menuq, NULL, NULL, 0, + if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, NULL, NULL)) != NULL) { gc = (struct group_ctx *)mi->ctx; (group_holds_only_hidden(gc)) ? @@ -225,7 +225,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg) if (TAILQ_EMPTY(&menuq)) return; - if ((mi = menu_filter(sc, &menuq, NULL, NULL, 0, + if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, NULL, NULL)) != NULL) { cc = (struct client_ctx *)mi->ctx; client_unhide(cc); @@ -251,7 +251,7 @@ mousefunc_menu_cmd(struct client_ctx *cc, union arg *arg) if (TAILQ_EMPTY(&menuq)) return; - if ((mi = menu_filter(sc, &menuq, NULL, NULL, 0, + if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, NULL, NULL)) != NULL) u_spawn(((struct cmd *)mi->ctx)->path); -- cgit 1.4.1 From bd5f724931404c9dd95eda0c9c962a68e9e31ef2 Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 7 Jun 2015 19:10:00 +0000 Subject: even if the menuq is empty, at least show an empty menu instead of just bailing making it look like the binding isn't working. --- mousefunc.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'mousefunc.c') diff --git a/mousefunc.c b/mousefunc.c index a1d7e06..e06196f 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -188,8 +188,6 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg) group_holds_only_hidden(gc) ? "%d: [%s]" : "%d: %s", gc->num, gc->name); } - if (TAILQ_EMPTY(&menuq)) - return; if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, NULL, NULL)) != NULL) { @@ -222,8 +220,6 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg) cc->group ? cc->group->num : 0, wname); } } - if (TAILQ_EMPTY(&menuq)) - return; if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, NULL, NULL)) != NULL) { @@ -248,8 +244,6 @@ mousefunc_menu_cmd(struct client_ctx *cc, union arg *arg) TAILQ_INIT(&menuq); TAILQ_FOREACH(cmd, &Conf.cmdq, entry) menuq_add(&menuq, cmd, "%s", cmd->name); - if (TAILQ_EMPTY(&menuq)) - return; if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, NULL, NULL)) != NULL) -- cgit 1.4.1 From 9180bb1a06abc01e8b0eaa0ae6b8c934988a8f6e Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Jun 2015 15:11:29 +0000 Subject: stash window dimensions --- calmwm.h | 4 ++++ client.c | 3 +++ mousefunc.c | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'mousefunc.c') diff --git a/calmwm.h b/calmwm.h index 69b8a9d..b7d8a8a 100644 --- a/calmwm.h +++ b/calmwm.h @@ -169,6 +169,10 @@ struct client_ctx { int x; /* x position */ int y; /* y position */ } ptr; + struct { + int h; /* hieght */ + int w; /* width */ + } dim; #define CLIENT_HIDDEN 0x0001 #define CLIENT_IGNORE 0x0002 #define CLIENT_VMAXIMIZED 0x0004 diff --git a/client.c b/client.c index 811ee18..16eee3a 100644 --- a/client.c +++ b/client.c @@ -874,6 +874,9 @@ client_applysizehints(struct client_ctx *cc) cc->geom.w = MAX(cc->geom.w, 1); cc->geom.h = MAX(cc->geom.h, 1); + + cc->dim.w = (cc->geom.w - cc->hint.basew) / cc->hint.incw; + cc->dim.h = (cc->geom.h - cc->hint.baseh) / cc->hint.inch; } static void diff --git a/mousefunc.c b/mousefunc.c index e06196f..718a577 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -53,9 +53,7 @@ mousefunc_sweep_draw(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; char s[14]; /* fits " nnnn x nnnn \0" */ - (void)snprintf(s, sizeof(s), " %4d x %-4d ", - (cc->geom.w - cc->hint.basew) / cc->hint.incw, - (cc->geom.h - cc->hint.baseh) / cc->hint.inch); + (void)snprintf(s, sizeof(s), " %4d x %-4d ", cc->dim.w, cc->dim.h); XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0); XMoveResizeWindow(X_Dpy, sc->menuwin, 0, 0, -- cgit 1.4.1 From e9750e2144a48dc10cab60dd4a07f537b6dcd20d Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Jun 2015 15:41:27 +0000 Subject: switch to search_print_client() as the print callback since it will now display labels as well --- mousefunc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'mousefunc.c') diff --git a/mousefunc.c b/mousefunc.c index 718a577..e48833c 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -204,23 +204,18 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg) struct client_ctx *old_cc; struct menu *mi; struct menu_q menuq; - char *wname; old_cc = client_current(); TAILQ_INIT(&menuq); TAILQ_FOREACH(cc, &sc->clientq, entry) { if (cc->flags & CLIENT_HIDDEN) { - wname = (cc->label) ? cc->label : cc->name; - if (wname == NULL) - continue; - menuq_add(&menuq, cc, "(%d) %s", - cc->group ? cc->group->num : 0, wname); + menuq_add(&menuq, cc, NULL); } } if ((mi = menu_filter(sc, &menuq, NULL, NULL, CWM_MENU_LIST, - NULL, NULL)) != NULL) { + NULL, search_print_client)) != NULL) { cc = (struct client_ctx *)mi->ctx; client_unhide(cc); if (old_cc != NULL) -- cgit 1.4.1