[hackers] [dmenu] more efficient initfont || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Tue, 10 Aug 2010 17:09:07 +0000 (UTC)

changeset: 356:536167394d87
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Tue Aug 10 18:09:02 2010 +0100
files: dmenu.c
description:
more efficient initfont

diff -r 886757898b8b -r 536167394d87 dmenu.c
--- a/dmenu.c Tue Aug 10 14:14:37 2010 +0100
+++ b/dmenu.c Tue Aug 10 18:09:02 2010 +0100
@@ -41,6 +41,7 @@
 
 static char text[BUFSIZ];
 static size_t cursor = 0;
+static const char *font = NULL;
 static const char *prompt = NULL;
 static const char *normbgcolor = "#cccccc";
 static const char *normfgcolor = "#000000";
@@ -501,8 +502,6 @@
         int i;
 
         progname = "dmenu";
- dc = initdraw();
-
         for(i = 1; i < argc; i++)
                 /* single flags */
                 if(!strcmp(argv[i], "-v")) {
@@ -523,7 +522,7 @@
                 else if(!strcmp(argv[i], "-p"))
                         prompt = argv[++i];
                 else if(!strcmp(argv[i], "-fn"))
- initfont(dc, argv[++i]);
+ font = argv[++i];
                 else if(!strcmp(argv[i], "-nb"))
                         normbgcolor = argv[++i];
                 else if(!strcmp(argv[i], "-nf"))
@@ -535,6 +534,8 @@
                 else
                         usage();
 
+ dc = initdraw();
+ initfont(dc, font);
         readstdin();
         setup();
         run();
Received on Tue Aug 10 2010 - 19:09:07 CEST

This archive was generated by hypermail 2.2.0 : Tue Aug 10 2010 - 19:12:04 CEST