Xinqi Bao's Git

initial import
[dmenu.git] / dmenu.h
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
5
6 #include "config.h"
7 #include <X11/Xlib.h>
8 #include <X11/Xlocale.h>
9
10 typedef struct Brush Brush;
11 typedef struct DC DC;
12 typedef struct Fnt Fnt;
13
14 struct Fnt {
15 XFontStruct *xfont;
16 XFontSet set;
17 int ascent;
18 int descent;
19 int height;
20 };
21
22 struct DC { /* draw context */
23 int x, y, w, h;
24 unsigned long bg;
25 unsigned long fg;
26 unsigned long border;
27 Drawable drawable;
28 Fnt font;
29 GC gc;
30 };
31
32 struct Brush {
33 GC gc;
34 Drawable drawable;
35 int x, y, w, h;
36 Fnt font;
37 unsigned long bg;
38 unsigned long fg;
39 unsigned long border;
40 };
41
42
43
44 /* draw.c */
45 extern void draw(Display *dpy, Brush *b, Bool border, const char *text);
46 extern void loadcolors(Display *dpy, int screen, Brush *b,
47 const char *bg, const char *fg, const char *bo);
48 extern void loadfont(Display *dpy, Fnt *font, const char *fontstr);
49 extern unsigned int textnw(Fnt *font, char *text, unsigned int len);
50 extern unsigned int textw(Fnt *font, char *text);
51 extern unsigned int texth(Fnt *font);
52
53 /* util.c */
54 extern void *emalloc(unsigned int size);
55 extern void *emallocz(unsigned int size);
56 extern void eprint(const char *errstr, ...);
57 extern char *estrdup(const char *str);
58 extern void swap(void **p1, void **p2);