aboutsummaryrefslogtreecommitdiff
path: root/dinput.c
diff options
context:
space:
mode:
Diffstat (limited to 'dinput.c')
-rw-r--r--dinput.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/dinput.c b/dinput.c
index 0bf2679..b69dcb3 100644
--- a/dinput.c
+++ b/dinput.c
@@ -76,11 +76,11 @@ drawinput(void)
76 /* print prompt? */ 76 /* print prompt? */
77 if(prompt) { 77 if(prompt) {
78 dc.w = promptw; 78 dc.w = promptw;
79 drawtext(&dc, prompt, selcol, False); 79 drawtext(&dc, prompt, normcol, False);
80 dc.x += dc.w; 80 dc.x += dc.w;
81 } 81 }
82 dc.w = mw - dc.x; 82 dc.w = mw - dc.x;
83 drawtext(&dc, *text ? text : NULL, normcol, False); 83 drawtext(&dc, *text ? text : NULL, selcol, False);
84 drawcursor(); 84 drawcursor();
85 XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, mw, mh, 0, 0); 85 XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, mw, mh, 0, 0);
86 XFlush(dpy); 86 XFlush(dpy);
@@ -329,11 +329,15 @@ main(int argc, char *argv[]) {
329 /* command line args */ 329 /* command line args */
330 progname = argv[0]; 330 progname = argv[0];
331 for(i = 1; i < argc; i++) 331 for(i = 1; i < argc; i++)
332 if(!strcmp(argv[i], "-b")) 332 if(!strcmp(argv[i], "-i"))
333 ; /* ignore flag */
334 else if(!strcmp(argv[i], "-b"))
333 topbar = False; 335 topbar = False;
334 else if(!strcmp(argv[i], "-e")) { 336 else if(!strcmp(argv[i], "-e")) {
335 if(++i < argc) parent = atoi(argv[i]); 337 if(++i < argc) parent = atoi(argv[i]);
336 } 338 }
339 else if(!strcmp(argv[i], "-l"))
340 i++; /* ignore flag */
337 else if(!strcmp(argv[i], "-fn")) { 341 else if(!strcmp(argv[i], "-fn")) {
338 if(++i < argc) font = argv[i]; 342 if(++i < argc) font = argv[i];
339 } 343 }
@@ -352,13 +356,17 @@ main(int argc, char *argv[]) {
352 else if(!strcmp(argv[i], "-sf")) { 356 else if(!strcmp(argv[i], "-sf")) {
353 if(++i < argc) selfgcolor = argv[i]; 357 if(++i < argc) selfgcolor = argv[i];
354 } 358 }
355 else if(!strcmp(argv[i], "-v")) 359 else if(!strcmp(argv[i], "-v")) {
356 eprint("dinput-"VERSION", © 2006-2010 dinput engineers, see LICENSE for details\n"); 360 printf("dinput-"VERSION", © 2006-2010 dinput engineers, see LICENSE for details\n");
361 exit(EXIT_SUCCESS);
362 }
357 else if(!*text) 363 else if(!*text)
358 strncpy(text, argv[i], sizeof text); 364 strncpy(text, argv[i], sizeof text);
359 else 365 else {
360 eprint("usage: dinput [-b] [-e <xid>] [-fn <font>] [-nb <color>] [-nf <color>]\n" 366 fputs("usage: dinput [-b] [-e <xid>] [-fn <font>] [-nb <color>] [-nf <color>]\n"
361 " [-p <prompt>] [-sb <color>] [-sf <color>] [-v] [<text>]\n"); 367 " [-p <prompt>] [-sb <color>] [-sf <color>] [-v] [<text>]\n", stderr);
368 exit(EXIT_FAILURE);
369 }
362 if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) 370 if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
363 fprintf(stderr, "dinput: warning: no locale support\n"); 371 fprintf(stderr, "dinput: warning: no locale support\n");
364 if(!(dpy = XOpenDisplay(NULL))) 372 if(!(dpy = XOpenDisplay(NULL)))