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