[dev] [dmenu] [PATCH] Configuration header file added.

From: Alexander Sedov <alex0player_AT_gmail.com>
Date: Mon, 15 Apr 2013 11:57:19 +0400

---
 Makefile     |    6 +++++-
 config.def.h |   15 +++++++++++++++
 dmenu.c      |   10 ++--------
 3 files changed, 22 insertions(+), 9 deletions(-)
 create mode 100644 config.def.h
diff --git a/Makefile b/Makefile
index f011ad7..0f7dfbd 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -18,7 +18,11 @@ options:
 	_AT_echo CC -c $<
 	_AT_${CC} -c $< ${CFLAGS}
 
-${OBJ}: config.mk draw.h
+config.h:
+	_AT_echo creating $@ from config.def.h
+	_AT_cp config.def.h $@
+
+${OBJ}: config.h config.mk draw.h
 
 dmenu: dmenu.o draw.o
 	_AT_echo CC -o $@
diff --git a/config.def.h b/config.def.h
new file mode 100644
index 0000000..35fc227
--- /dev/null
+++ b/config.def.h
_AT_@ -0,0 +1,15 @@
+/* See LICENSE file for copyright and license details. */
+/* vim: expandtab
+ */
+/* Default settings; can be overrided by command line. */
+
+static Bool topbar = True;                  /* -b  option; if False, dmenu appears at bottom */
+static const char *font = NULL;             /* -fn option; default X11 font or font set      */
+static const char *prompt = NULL;           /* -p  option; prompt to the elft of input field */
+static const char *normbgcolor = "#222222"; /* -nb option; normal background                 */
+static const char *normfgcolor = "#bbbbbb"; /* -nf option; normal foreground                 */
+static const char *selbgcolor  = "#005577"; /* -sb option; selected background               */
+static const char *selfgcolor  = "#eeeeee"; /* -sf option; selected foreground               */
+/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
+static unsigned int lines = 0;
+
diff --git a/dmenu.c b/dmenu.c
index 86f8c46..b750a46 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -43,17 +43,9 @@ static char text[BUFSIZ] = "";
 static int bh, mw, mh;
 static int inputw, promptw;
 static size_t cursor = 0;
-static const char *font = NULL;
-static const char *prompt = NULL;
-static const char *normbgcolor = "#222222";
-static const char *normfgcolor = "#bbbbbb";
-static const char *selbgcolor  = "#005577";
-static const char *selfgcolor  = "#eeeeee";
-static unsigned int lines = 0;
 static unsigned long normcol[ColLast];
 static unsigned long selcol[ColLast];
 static Atom clip, utf8;
-static Bool topbar = True;
 static DC *dc;
 static Item *items = NULL;
 static Item *matches, *matchend;
_AT_@ -61,6 +53,8 @@ static Item *prev, *curr, *next, *sel;
 static Window win;
 static XIC xic;
 
+#include "config.h"
+
 static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
 static char *(*fstrstr)(const char *, const char *) = strstr;
 
-- 
1.7.10.4
Received on Mon Apr 15 2013 - 09:57:19 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 15 2013 - 10:00:08 CEST