From 2aded9f921d40f5977694087402570c7bea4ec57 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 | 3 ++- menu.c | 6 ++++-- mousefunc.c | 8 ++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/calmwm.h b/calmwm.h index 9681411..cde8678 100644 --- a/calmwm.h +++ b/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.289 2015/05/21 00:37:04 okan Exp $ + * $OpenBSD: calmwm.h,v 1.290 2015/06/05 15:01:51 okan Exp $ */ #ifndef _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 e5e992b..868dac5 100644 --- a/menu.c +++ b/menu.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: menu.c,v 1.80 2015/06/05 14:54:04 okan Exp $ + * $OpenBSD: menu.c,v 1.81 2015/06/05 15:01:51 okan Exp $ */ #include @@ -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 2fe6908..48d1fc4 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.87 2015/05/21 00:37:04 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.88 2015/06/05 15:01:51 okan Exp $ */ #include @@ -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 v1.2.3-2-gb3c3