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 diff
     1.1 --- a/menu.c	Wed Jul 12 17:50:31 2006 +0200
     1.2 +++ b/menu.c	Thu Jul 13 01:04:38 2006 +0200
     1.3 @@ -12,9 +12,6 @@
     1.4  #include <stdlib.h>
     1.5  #include <stdio.h>
     1.6  #include <string.h>
     1.7 -#include <sys/stat.h>
     1.8 -#include <sys/wait.h>
     1.9 -#include <time.h>
    1.10  #include <unistd.h>
    1.11  #include <X11/cursorfont.h>
    1.12  #include <X11/Xutil.h>
    1.13 @@ -58,11 +55,7 @@
    1.14  static char version[] = "gridmenu - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
    1.15  
    1.16  static void
    1.17 -usage()
    1.18 -{
    1.19 -	fprintf(stderr, "%s", "usage: gridmenu [-v] [-t <title>]\n");
    1.20 -	exit(1);
    1.21 -}
    1.22 +usage() { error("usage: gridmenu [-v] [-t <title>]\n"); }
    1.23  
    1.24  static void
    1.25  update_offsets()
    1.26 @@ -213,26 +206,12 @@
    1.27  	/* first check if a control mask is omitted */
    1.28  	if(e->state & ControlMask) {
    1.29  		switch (ksym) {
    1.30 -		case XK_H:
    1.31 +		default:	/* ignore other control sequences */
    1.32 +			return;
    1.33 +			break;
    1.34  		case XK_h:
    1.35  			ksym = XK_BackSpace;
    1.36  			break;
    1.37 -		case XK_I:
    1.38 -		case XK_i:
    1.39 -			ksym = XK_Tab;
    1.40 -			break;
    1.41 -		case XK_J:
    1.42 -		case XK_j:
    1.43 -			ksym = XK_Return;
    1.44 -			break;
    1.45 -		case XK_N:
    1.46 -		case XK_n:
    1.47 -			ksym = XK_Right;
    1.48 -			break;
    1.49 -		case XK_P:
    1.50 -		case XK_p:
    1.51 -			ksym = XK_Left;
    1.52 -			break;
    1.53  		case XK_U:
    1.54  		case XK_u:
    1.55  			text[0] = 0;
    1.56 @@ -243,12 +222,9 @@
    1.57  		case XK_bracketleft:
    1.58  			ksym = XK_Escape;
    1.59  			break;
    1.60 -		default:	/* ignore other control sequences */
    1.61 -			return;
    1.62 -			break;
    1.63  		}
    1.64  	}
    1.65 -	switch (ksym) {
    1.66 +	switch(ksym) {
    1.67  	case XK_Left:
    1.68  		if(!(sel && sel->left))
    1.69  			return;
    1.70 @@ -432,21 +408,18 @@
    1.71  	XFlush(dpy);
    1.72  
    1.73  	/* main event loop */
    1.74 -	while(!XNextEvent(dpy, &ev)) {
    1.75 +	while(!done && !XNextEvent(dpy, &ev)) {
    1.76  		switch (ev.type) {
    1.77 -			case KeyPress:
    1.78 -				kpress(&ev.xkey);
    1.79 -				break;
    1.80 -			case Expose:
    1.81 -				if(ev.xexpose.count == 0) {
    1.82 -					draw_menu();
    1.83 -				}
    1.84 -				break;
    1.85 -			default:
    1.86 -				break;
    1.87 +		case KeyPress:
    1.88 +			kpress(&ev.xkey);
    1.89 +			break;
    1.90 +		case Expose:
    1.91 +			if(ev.xexpose.count == 0)
    1.92 +				draw_menu();
    1.93 +			break;
    1.94 +		default:
    1.95 +			break;
    1.96  		}
    1.97 -		if(done)
    1.98 -			break;
    1.99  	}
   1.100  
   1.101  	XUngrabKeyboard(dpy, CurrentTime);