comparison util.h @ 3:e969f3575b7a

several new changes, made gridmenu working
author Anselm R. Garbe <garbeam@wmii.de>
date Mon, 10 Jul 2006 19:46:24 +0200
parents a79188fe4a40
children e5018cae273f
comparison
equal deleted inserted replaced
2:a79188fe4a40 3:e969f3575b7a
1 /* 1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5 5
6 #include <X11/Xlib.h> 6 extern void error(char *errstr, ...);
7 #include <X11/Xlocale.h> 7 extern void *emallocz(unsigned int size);
8 8 extern void *emalloc(unsigned int size);
9 typedef struct Brush Brush; 9 extern void *erealloc(void *ptr, unsigned int size);
10 typedef struct Color Color; 10 extern char *estrdup(const char *str);
11 typedef struct Fnt Fnt; 11 #define eassert(a) do { \
12 12 if(!(a)) \
13 struct Color { 13 failed_assert(#a, __FILE__, __LINE__); \
14 unsigned long bg; 14 } while (0)
15 unsigned long fg; 15 void failed_assert(char *a, char *file, int line);
16 unsigned long border; 16 void swap(void **p1, void **p2);
17 };
18
19 struct Fnt {
20 XFontStruct *xfont;
21 XFontSet set;
22 int ascent;
23 int descent;
24 };
25
26 struct 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
36 extern void draw(Display *dpy, Brush *b);
37 extern void loadcolor(Display *dpy, int screen, Color *c,
38 const char *bg, const char *fg, const char *bo);
39 extern unsigned int textwidth_l(Fnt *font, char *text, unsigned int len);
40 extern unsigned int textwidth(Fnt *font, char *text);
41 extern void loadfont(Display *dpy, Fnt *font, const char *fontstr);