💾 Archived View for gemini.rmf-dev.com › repo › Vaati › fdwm › files › 64714316bd40c003eac6b722ba525… captured on 2023-01-29 at 04:32:16. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
0 /* See LICENSE file for copyright and license details. */
1
2 typedef struct {
3 Cursor cursor;
4 } Cur;
5
6 typedef struct Fnt {
7 Display *dpy;
8 unsigned int h;
9 XftFont *xfont;
10 FcPattern *pattern;
11 struct Fnt *next;
12 } Fnt;
13
14 enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */
15 typedef XftColor Clr;
16
17 typedef struct {
18 unsigned int w, h;
19 Display *dpy;
20 int screen;
21 Window root;
22 Drawable drawable;
23 GC gc;
24 Clr *scheme;
25 Fnt *fonts;
26 } Drw;
27
28 /* Drawable abstraction */
29 Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
30 void drw_resize(Drw *drw, unsigned int w, unsigned int h);
31 void drw_free(Drw *drw);
32
33 /* Fnt abstraction */
34 Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
35 void drw_fontset_free(Fnt* set);
36 unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
37 unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n);
38 void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
39
40 /* Colorscheme abstraction */
41 void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
42 Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
43
44 /* Cursor abstraction */
45 Cur *drw_cur_create(Drw *drw, int shape);
46 void drw_cur_free(Drw *drw, Cur *cursor);
47
48 /* Drawing context manipulation */
49 void drw_setfontset(Drw *drw, Fnt *set);
50 void drw_setscheme(Drw *drw, Clr *scm);
51
52 /* Drawing functions */
53 void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
54 int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
55
56 /* Map functions */
57 void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
58