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);
ed line information issue with user defined assertions' href='/ahoang/Nim/commit/compiler/semmagic.nim?h=devel&id=78f4aacde9e79e9a13b17dc2a3709d5f09a0ae0b'>78f4aacde ^
92b8fac94 ^
78f4aacde ^



a8e12afc7 ^
78f4aacde ^

438703f59 ^
78f4aacde ^
92b8fac94 ^
78f4aacde ^

08c0ba379 ^
6db20a4be ^

6a9baf3fd ^




afddae5aa ^
13c5f792d ^
6a9baf3fd ^




efb53233c ^

6db20a4be ^
afddae5aa ^

badb6c0f6 ^

73c6efdf6 ^
efb53233c ^
badb6c0f6 ^
efb53233c ^

4fbba0a65 ^




9a7f0cd85 ^


08c0ba379 ^
b5b5e6e76 ^
08c0ba379 ^
92b8fac94 ^
b5b5e6e76 ^
08c0ba379 ^
b5b5e6e76 ^


92b8fac94 ^
9a7f0cd85 ^
08c0ba379 ^
9a7f0cd85 ^
92b8fac94 ^
9a7f0cd85 ^

b5b5e6e76 ^
9a7f0cd85 ^

92b8fac94 ^
9a7f0cd85 ^
8c6290342 ^
5d63ecb3a ^




ed0d9e271 ^






08c0ba379 ^
2962ca789 ^

08c0ba379 ^

ab26298a0 ^
08c0ba379 ^


2962ca789 ^
efb53233c ^
af792da0b ^


78f4aacde ^
4fbba0a65 ^
0257f389f ^
8c6290342 ^
9a7f0cd85 ^
105a0616a ^


ed0d9e271 ^

2b80d75aa ^



5d63ecb3a ^
























4be0d1652 ^






2962ca789 ^
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179