diff options
author | Connor Lane Smith <cls@lubutu.com> | 2010-06-25 04:33:41 +0100 |
---|---|---|
committer | Connor Lane Smith <cls@lubutu.com> | 2010-06-25 04:33:41 +0100 |
commit | 9f3b0c6ea843340b87a045ea0afd2d1b33425eee (patch) | |
tree | 0ee0fc482aa4cb4c2d06bc85dd04cc7d69fdbfad | |
parent | 4508fd2c4ee3171bdc1bffb7e53ecda8290292ef (diff) |
cleaned up
-rw-r--r-- | dinput.c | 8 | ||||
-rw-r--r-- | dmenu.c | 11 |
2 files changed, 10 insertions, 9 deletions
@@ -25,7 +25,7 @@ static void cleanup(void); | |||
25 | static void drawcursor(void); | 25 | static void drawcursor(void); |
26 | static void drawinput(void); | 26 | static void drawinput(void); |
27 | static Bool grabkeyboard(void); | 27 | static Bool grabkeyboard(void); |
28 | static void kpress(XKeyEvent * e); | 28 | static void kpress(XKeyEvent *e); |
29 | static void run(void); | 29 | static void run(void); |
30 | static void setup(Bool topbar); | 30 | static void setup(Bool topbar); |
31 | 31 | ||
@@ -100,7 +100,7 @@ grabkeyboard(void) { | |||
100 | } | 100 | } |
101 | 101 | ||
102 | void | 102 | void |
103 | kpress(XKeyEvent * e) { | 103 | kpress(XKeyEvent *e) { |
104 | char buf[sizeof text]; | 104 | char buf[sizeof text]; |
105 | int num; | 105 | int num; |
106 | unsigned int i, len; | 106 | unsigned int i, len; |
@@ -140,6 +140,7 @@ kpress(XKeyEvent * e) { | |||
140 | ksym = XK_BackSpace; | 140 | ksym = XK_BackSpace; |
141 | break; | 141 | break; |
142 | case XK_j: | 142 | case XK_j: |
143 | case XK_m: | ||
143 | ksym = XK_Return; | 144 | ksym = XK_Return; |
144 | break; | 145 | break; |
145 | case XK_k: | 146 | case XK_k: |
@@ -274,12 +275,11 @@ setup(Bool topbar) { | |||
274 | selcol[ColBG] = getcolor(&dc, selbgcolor); | 275 | selcol[ColBG] = getcolor(&dc, selbgcolor); |
275 | selcol[ColFG] = getcolor(&dc, selfgcolor); | 276 | selcol[ColFG] = getcolor(&dc, selfgcolor); |
276 | initfont(&dc, font); | 277 | initfont(&dc, font); |
277 | fprintf(stderr, "dc.font.xfont: %u\n", (size_t)dc.font.xfont); | ||
278 | 278 | ||
279 | /* input window */ | 279 | /* input window */ |
280 | wa.override_redirect = True; | 280 | wa.override_redirect = True; |
281 | wa.background_pixmap = ParentRelative; | 281 | wa.background_pixmap = ParentRelative; |
282 | wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask | VisibilityChangeMask; | 282 | wa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; |
283 | 283 | ||
284 | /* input window geometry */ | 284 | /* input window geometry */ |
285 | mh = dc.font.height + 2; | 285 | mh = dc.font.height + 2; |
@@ -39,7 +39,7 @@ static void drawmenu(void); | |||
39 | static void drawmenuh(void); | 39 | static void drawmenuh(void); |
40 | static void drawmenuv(void); | 40 | static void drawmenuv(void); |
41 | static Bool grabkeyboard(void); | 41 | static Bool grabkeyboard(void); |
42 | static void kpress(XKeyEvent * e); | 42 | static void kpress(XKeyEvent *e); |
43 | static void match(char *pattern); | 43 | static void match(char *pattern); |
44 | static void readstdin(void); | 44 | static void readstdin(void); |
45 | static void run(void); | 45 | static void run(void); |
@@ -191,7 +191,7 @@ drawmenuh(void) { | |||
191 | dc.w = spaceitem; | 191 | dc.w = spaceitem; |
192 | drawtext(&dc, curr->left ? "<" : NULL, normcol); | 192 | drawtext(&dc, curr->left ? "<" : NULL, normcol); |
193 | dc.x += dc.w; | 193 | dc.x += dc.w; |
194 | for(i = curr; i != next; i=i->right) { | 194 | for(i = curr; i != next; i = i->right) { |
195 | dc.w = MIN(textw(&dc, i->text), mw / 3); | 195 | dc.w = MIN(textw(&dc, i->text), mw / 3); |
196 | drawtext(&dc, i->text, (sel == i) ? selcol : normcol); | 196 | drawtext(&dc, i->text, (sel == i) ? selcol : normcol); |
197 | dc.x += dc.w; | 197 | dc.x += dc.w; |
@@ -208,7 +208,7 @@ drawmenuv(void) { | |||
208 | dc.w = mw - dc.x; | 208 | dc.w = mw - dc.x; |
209 | dc.h = dc.font.height + 2; | 209 | dc.h = dc.font.height + 2; |
210 | dc.y = dc.h; | 210 | dc.y = dc.h; |
211 | for(i = curr; i != next; i=i->right) { | 211 | for(i = curr; i != next; i = i->right) { |
212 | drawtext(&dc, i->text, (sel == i) ? selcol : normcol); | 212 | drawtext(&dc, i->text, (sel == i) ? selcol : normcol); |
213 | dc.y += dc.h; | 213 | dc.y += dc.h; |
214 | } | 214 | } |
@@ -230,7 +230,7 @@ grabkeyboard(void) { | |||
230 | } | 230 | } |
231 | 231 | ||
232 | void | 232 | void |
233 | kpress(XKeyEvent * e) { | 233 | kpress(XKeyEvent *e) { |
234 | char buf[sizeof text]; | 234 | char buf[sizeof text]; |
235 | int num; | 235 | int num; |
236 | unsigned int i, len; | 236 | unsigned int i, len; |
@@ -273,6 +273,7 @@ kpress(XKeyEvent * e) { | |||
273 | ksym = XK_Tab; | 273 | ksym = XK_Tab; |
274 | break; | 274 | break; |
275 | case XK_j: | 275 | case XK_j: |
276 | case XK_m: | ||
276 | ksym = XK_Return; | 277 | ksym = XK_Return; |
277 | break; | 278 | break; |
278 | case XK_n: | 279 | case XK_n: |
@@ -501,7 +502,7 @@ setup(Bool topbar) { | |||
501 | /* menu window */ | 502 | /* menu window */ |
502 | wa.override_redirect = True; | 503 | wa.override_redirect = True; |
503 | wa.background_pixmap = ParentRelative; | 504 | wa.background_pixmap = ParentRelative; |
504 | wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask | VisibilityChangeMask; | 505 | wa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; |
505 | 506 | ||
506 | /* menu window geometry */ | 507 | /* menu window geometry */ |
507 | mh = (dc.font.height + 2) * (lines + 1); | 508 | mh = (dc.font.height + 2) * (lines + 1); |