Mercurial > dwm-meillo
diff menu.c @ 31:386649deb651
before leaning things up
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 01:04:38 +0200 |
parents | e8f627998d6f |
children |
line wrap: on
line diff
--- a/menu.c Wed Jul 12 17:50:31 2006 +0200 +++ b/menu.c Thu Jul 13 01:04:38 2006 +0200 @@ -12,9 +12,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <time.h> #include <unistd.h> #include <X11/cursorfont.h> #include <X11/Xutil.h> @@ -58,11 +55,7 @@ static char version[] = "gridmenu - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; static void -usage() -{ - fprintf(stderr, "%s", "usage: gridmenu [-v] [-t <title>]\n"); - exit(1); -} +usage() { error("usage: gridmenu [-v] [-t <title>]\n"); } static void update_offsets() @@ -213,26 +206,12 @@ /* first check if a control mask is omitted */ if(e->state & ControlMask) { switch (ksym) { - case XK_H: + default: /* ignore other control sequences */ + return; + break; case XK_h: ksym = XK_BackSpace; break; - case XK_I: - case XK_i: - ksym = XK_Tab; - break; - case XK_J: - case XK_j: - ksym = XK_Return; - break; - case XK_N: - case XK_n: - ksym = XK_Right; - break; - case XK_P: - case XK_p: - ksym = XK_Left; - break; case XK_U: case XK_u: text[0] = 0; @@ -243,12 +222,9 @@ case XK_bracketleft: ksym = XK_Escape; break; - default: /* ignore other control sequences */ - return; - break; } } - switch (ksym) { + switch(ksym) { case XK_Left: if(!(sel && sel->left)) return; @@ -432,21 +408,18 @@ XFlush(dpy); /* main event loop */ - while(!XNextEvent(dpy, &ev)) { + while(!done && !XNextEvent(dpy, &ev)) { switch (ev.type) { - case KeyPress: - kpress(&ev.xkey); - break; - case Expose: - if(ev.xexpose.count == 0) { - draw_menu(); - } - break; - default: - break; + case KeyPress: + kpress(&ev.xkey); + break; + case Expose: + if(ev.xexpose.count == 0) + draw_menu(); + break; + default: + break; } - if(done) - break; } XUngrabKeyboard(dpy, CurrentTime);