more efficient initfont
e149c531
1 file(s) · +4 −3
| 41 | 41 | ||
| 42 | 42 | static char text[BUFSIZ]; |
|
| 43 | 43 | static size_t cursor = 0; |
|
| 44 | + | static const char *font = NULL; |
|
| 44 | 45 | static const char *prompt = NULL; |
|
| 45 | 46 | static const char *normbgcolor = "#cccccc"; |
|
| 46 | 47 | static const char *normfgcolor = "#000000"; |
|
| 501 | 502 | int i; |
|
| 502 | 503 | ||
| 503 | 504 | progname = "dmenu"; |
|
| 504 | - | dc = initdraw(); |
|
| 505 | - | ||
| 506 | 505 | for(i = 1; i < argc; i++) |
|
| 507 | 506 | /* single flags */ |
|
| 508 | 507 | if(!strcmp(argv[i], "-v")) { |
|
| 523 | 522 | else if(!strcmp(argv[i], "-p")) |
|
| 524 | 523 | prompt = argv[++i]; |
|
| 525 | 524 | else if(!strcmp(argv[i], "-fn")) |
|
| 526 | - | initfont(dc, argv[++i]); |
|
| 525 | + | font = argv[++i]; |
|
| 527 | 526 | else if(!strcmp(argv[i], "-nb")) |
|
| 528 | 527 | normbgcolor = argv[++i]; |
|
| 529 | 528 | else if(!strcmp(argv[i], "-nf")) |
|
| 535 | 534 | else |
|
| 536 | 535 | usage(); |
|
| 537 | 536 | ||
| 537 | + | dc = initdraw(); |
|
| 538 | + | initfont(dc, font); |
|
| 538 | 539 | readstdin(); |
|
| 539 | 540 | setup(); |
|
| 540 | 541 | run(); |
|