util.h (view raw)
1/*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
5
6#include <X11/Xlib.h>
7#include <X11/Xlocale.h>
8
9typedef struct Brush Brush;
10typedef struct Color Color;
11typedef struct Fnt Fnt;
12
13struct Color {
14 unsigned long bg;
15 unsigned long fg;
16 unsigned long border;
17};
18
19struct Fnt {
20 XFontStruct *xfont;
21 XFontSet set;
22 int ascent;
23 int descent;
24};
25
26struct Brush {
27 GC gc;
28 Drawable drawable;
29 XRectangle rect;
30 Bool border;
31 Fnt *font;
32 Color color;
33 const char *text;
34};
35
36extern void draw(Display *dpy, Brush *b);
37extern void loadcolor(Display *dpy, int screen, Color *c,
38 const char *bg, const char *fg, const char *bo);
39extern unsigned int textwidth_l(Fnt *font, char *text, unsigned int len);
40extern unsigned int textwidth(Fnt *font, char *text);
41extern void loadfont(Display *dpy, Fnt *font, const char *fontstr);