aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Lane Smith <cls@lubutu.com>2010-06-25 04:33:41 +0100
committerConnor Lane Smith <cls@lubutu.com>2010-06-25 04:33:41 +0100
commit9f3b0c6ea843340b87a045ea0afd2d1b33425eee (patch)
tree0ee0fc482aa4cb4c2d06bc85dd04cc7d69fdbfad
parent4508fd2c4ee3171bdc1bffb7e53ecda8290292ef (diff)
cleaned up
-rw-r--r--dinput.c8
-rw-r--r--dmenu.c11
2 files changed, 10 insertions, 9 deletions
diff --git a/dinput.c b/dinput.c
index 283b018..228780c 100644
--- a/dinput.c
+++ b/dinput.c
@@ -25,7 +25,7 @@ static void cleanup(void);
25static void drawcursor(void); 25static void drawcursor(void);
26static void drawinput(void); 26static void drawinput(void);
27static Bool grabkeyboard(void); 27static Bool grabkeyboard(void);
28static void kpress(XKeyEvent * e); 28static void kpress(XKeyEvent *e);
29static void run(void); 29static void run(void);
30static void setup(Bool topbar); 30static void setup(Bool topbar);
31 31
@@ -100,7 +100,7 @@ grabkeyboard(void) {
100} 100}
101 101
102void 102void
103kpress(XKeyEvent * e) { 103kpress(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;
diff --git a/dmenu.c b/dmenu.c
index 6641ba2..8c0ea41 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -39,7 +39,7 @@ static void drawmenu(void);
39static void drawmenuh(void); 39static void drawmenuh(void);
40static void drawmenuv(void); 40static void drawmenuv(void);
41static Bool grabkeyboard(void); 41static Bool grabkeyboard(void);
42static void kpress(XKeyEvent * e); 42static void kpress(XKeyEvent *e);
43static void match(char *pattern); 43static void match(char *pattern);
44static void readstdin(void); 44static void readstdin(void);
45static void run(void); 45static 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
232void 232void
233kpress(XKeyEvent * e) { 233kpress(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);