Xinqi Bao's Git

fixed a small bug in dmenu when an empty font is supplied
[dmenu.git] / dmenu.h
1 /* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
2 * © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
3 * See LICENSE file for license details. */
4 #include <X11/Xlib.h>
5
6 #define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
7 #define NORMBGCOLOR "#eeeeee"
8 #define NORMFGCOLOR "#222222"
9 #define SELBGCOLOR "#006699"
10 #define SELFGCOLOR "#ffffff"
11 #define SPACE 30 /* px */
12
13 /* color */
14 enum { ColFG, ColBG, ColLast };
15
16 typedef struct {
17 int x, y, w, h;
18 unsigned long norm[ColLast];
19 unsigned long sel[ColLast];
20 Drawable drawable;
21 GC gc;
22 struct {
23 XFontStruct *xfont;
24 XFontSet set;
25 int ascent;
26 int descent;
27 int height;
28 } font;
29 } DC; /* draw context */
30
31 int screen;
32 Display *dpy;
33 DC dc; /* global drawing context */
34
35 /* draw.c */
36 void drawtext(const char *text, unsigned long col[ColLast]);
37 unsigned int textw(const char *text);
38 unsigned int textnw(const char *text, unsigned int len);
39
40 /* util.c */
41 void *emalloc(unsigned int size); /* allocates memory, exits on error */
42 void eprint(const char *errstr, ...); /* prints errstr and exits with 1 */
43 char *estrdup(const char *str); /* duplicates str, exits on allocation error */