aboutsummaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
authorokan2015-06-08 15:08:44 +0000
committerokan2015-06-08 15:08:44 +0000
commit8f9657c7874a16c6c163260692f13b8105cc3c2d (patch)
treeb7a97c38e3ad74f0fe3f77a42d436454908ba76a /menu.c
parent4e6c9abaf282fdf8950445d4d93ca4cea4e0cd9f (diff)
downloadcwm-8f9657c7874a16c6c163260692f13b8105cc3c2d.tar.gz
clean up
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/menu.c b/menu.c
index 37d9843..cdfc5f4 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.82 2015/06/05 18:43:36 okan Exp $
+ * $OpenBSD: menu.c,v 1.83 2015/06/08 15:08:44 okan Exp $
*/
#include <sys/types.h>
@@ -93,20 +93,15 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt,
(void)memset(&mc, 0, sizeof(mc));
- xu_ptr_getpos(sc->rootwin, &mc.geom.x, &mc.geom.y);
-
- xsave = mc.geom.x;
- ysave = mc.geom.y;
+ xu_ptr_getpos(sc->rootwin, &xsave, &ysave);
mc.sc = sc;
mc.flags = flags;
- if (prompt != NULL) {
- evmask = MENUMASK | KEYMASK; /* accept keys as well */
- (void)strlcpy(mc.promptstr, prompt, sizeof(mc.promptstr));
- mc.hasprompt = 1;
- } else {
- evmask = MENUMASK;
- }
+ mc.match = match;
+ mc.print = print;
+ mc.entry = mc.prev = -1;
+ mc.geom.x = xsave;
+ mc.geom.y = ysave;
if (mc.flags & CWM_MENU_LIST)
mc.list = 1;
@@ -116,9 +111,12 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt,
else
mc.searchstr[0] = '\0';
- mc.match = match;
- mc.print = print;
- mc.entry = mc.prev = -1;
+ evmask = MENUMASK;
+ if (prompt != NULL) {
+ evmask |= KEYMASK; /* accept keys as well */
+ (void)strlcpy(mc.promptstr, prompt, sizeof(mc.promptstr));
+ mc.hasprompt = 1;
+ }
XSelectInput(X_Dpy, sc->menuwin, evmask);
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)) {
/* Copy them all over. */
TAILQ_FOREACH(mi, menuq, entry)
- TAILQ_INSERT_TAIL(resultq, mi,
- resultentry);
+ TAILQ_INSERT_TAIL(resultq, mi, resultentry);
mc->listing = 1;
} else if (mc->changed)