about summary refs log tree commit diff stats
path: root/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c57
1 files changed, 15 insertions, 42 deletions
diff --git a/menu.c b/menu.c
index 2392ed5..f150dbc 100644
--- a/menu.c
+++ b/menu.c
@@ -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 void kpress(XKeyEvent * e);
 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 @@ kpress(XKeyEvent * e)
 	/* 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 @@ kpress(XKeyEvent * e)
 		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 @@ main(int argc, char *argv[])
 	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;
-		}
-		if(done)
+		case KeyPress:
+			kpress(&ev.xkey);
+			break;
+		case Expose:
+			if(ev.xexpose.count == 0)
+				draw_menu();
 			break;
+		default:
+			break;
+		}
 	}
 
 	XUngrabKeyboard(dpy, CurrentTime);
Morrison <ben@gbmor.dev> 2019-05-24 02:11:57 -0400 checking for X-Forwarded-For header when adding user IP to context' href='/gbmor/getwtxt/commit/http.go?h=v0.3.1&id=dbc93a011f442d09a18b7ae4ab34a8cfe64431dc'>dbc93a0 ^
a6f47c0 ^


07872ef ^



1168570 ^
d3d9df2 ^

1168570 ^
df1d1ef ^
747f4fb ^
1168570 ^


893123c ^
fc49c57 ^
df1d1ef ^
893123c ^
b9d16fb ^
1168570 ^

747f4fb ^
1168570 ^



b9d16fb ^
d3d9df2 ^
1168570 ^
4fa97ee ^
b6e7bb3 ^
1168570 ^
4fa97ee ^
b9d16fb ^
d3d9df2 ^
37be25f ^
505c5d8 ^
27f92d8 ^
37be25f ^
505c5d8 ^

1168570 ^
4fa97ee ^
d2680fb ^
1168570 ^
3596509 ^
1168570 ^
d2680fb ^

1168570 ^
4fa97ee ^
fc49c57 ^
1168570 ^
3596509 ^
1168570 ^
d6fbc25 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92