This commit is contained in:
okan 2015-06-08 15:08:44 +00:00
parent bd5f724931
commit 8653c88c90

29
menu.c
View File

@ -93,20 +93,15 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt,
(void)memset(&mc, 0, sizeof(mc)); (void)memset(&mc, 0, sizeof(mc));
xu_ptr_getpos(sc->rootwin, &mc.geom.x, &mc.geom.y); xu_ptr_getpos(sc->rootwin, &xsave, &ysave);
xsave = mc.geom.x;
ysave = mc.geom.y;
mc.sc = sc; mc.sc = sc;
mc.flags = flags; mc.flags = flags;
if (prompt != NULL) { mc.match = match;
evmask = MENUMASK | KEYMASK; /* accept keys as well */ mc.print = print;
(void)strlcpy(mc.promptstr, prompt, sizeof(mc.promptstr)); mc.entry = mc.prev = -1;
mc.hasprompt = 1; mc.geom.x = xsave;
} else { mc.geom.y = ysave;
evmask = MENUMASK;
}
if (mc.flags & CWM_MENU_LIST) if (mc.flags & CWM_MENU_LIST)
mc.list = 1; mc.list = 1;
@ -116,9 +111,12 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt,
else else
mc.searchstr[0] = '\0'; mc.searchstr[0] = '\0';
mc.match = match; evmask = MENUMASK;
mc.print = print; if (prompt != NULL) {
mc.entry = mc.prev = -1; evmask |= KEYMASK; /* accept keys as well */
(void)strlcpy(mc.promptstr, prompt, sizeof(mc.promptstr));
mc.hasprompt = 1;
}
XSelectInput(X_Dpy, sc->menuwin, evmask); XSelectInput(X_Dpy, sc->menuwin, evmask);
XMapRaised(X_Dpy, sc->menuwin); XMapRaised(X_Dpy, sc->menuwin);
@ -340,8 +338,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
if (TAILQ_EMPTY(resultq)) { if (TAILQ_EMPTY(resultq)) {
/* Copy them all over. */ /* Copy them all over. */
TAILQ_FOREACH(mi, menuq, entry) TAILQ_FOREACH(mi, menuq, entry)
TAILQ_INSERT_TAIL(resultq, mi, TAILQ_INSERT_TAIL(resultq, mi, resultentry);
resultentry);
mc->listing = 1; mc->listing = 1;
} else if (mc->changed) } else if (mc->changed)