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