removed useless newlines
[dmenu.git] / dmenu.h
1 /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
2  * See LICENSE file for license details.
3  */
4
5 #include <X11/Xlib.h>
6 #include <X11/Xlocale.h>
7
8 #define FONT                    "fixed"
9 #define NORMBGCOLOR             "#333366"
10 #define NORMFGCOLOR             "#cccccc"
11 #define SELBGCOLOR              "#666699"
12 #define SELFGCOLOR              "#eeeeee"
13 #define SPACE           30 /* px */
14
15 /* color */
16 enum { ColFG, ColBG, ColLast };
17
18 typedef struct DC DC;
19 typedef struct Fnt Fnt;
20
21 struct Fnt {
22         XFontStruct *xfont;
23         XFontSet set;
24         int ascent;
25         int descent;
26         int height;
27 };
28
29 struct DC {
30         int x, y, w, h;
31         unsigned long norm[ColLast];
32         unsigned long sel[ColLast];
33         Drawable drawable;
34         Fnt font;
35         GC gc;
36 }; /* draw context */
37
38 extern int screen;
39 extern Display *dpy;
40 extern DC dc;                   /* global drawing context */
41
42 /* draw.c */
43 extern void drawtext(const char *text,
44                         unsigned long col[ColLast]);    /* draws text with the defined color tuple */
45 extern unsigned long getcolor(const char *colstr);      /* returns color of colstr */
46 extern void setfont(const char *fontstr);               /* sets global font */
47 extern unsigned int textw(const char *text);            /* returns width of text in px */
48
49 /* util.c */
50 extern void *emalloc(unsigned int size);                /* allocates memory, exits on error */
51 extern void eprint(const char *errstr, ...);            /* prints errstr and exits with 1 */
52 extern char *estrdup(const char *str);                  /* duplicates str, exits on allocation error */