diff options
| author | Anselm R Garbe <anselm@garbe.us> | 2013-06-16 15:20:29 +0200 |
|---|---|---|
| committer | Anselm R Garbe <anselm@garbe.us> | 2013-06-16 15:20:29 +0200 |
| commit | 5364697914fd4272fc1a6494b4fc522d2935427a (patch) | |
| tree | e315c431f0c1b13907eb7e3513e73fd40fc6b433 /drw.h | |
| parent | include font argument for st by default (diff) | |
| download | dwm-5364697914fd4272fc1a6494b4fc522d2935427a.tar.gz dwm-5364697914fd4272fc1a6494b4fc522d2935427a.zip | |
finished libsl/drw integration
Diffstat (limited to '')
| -rw-r--r-- | drw.h | 46 |
1 files changed, 27 insertions, 19 deletions
| @@ -5,6 +5,10 @@ typedef struct { | |||
| 5 | } Clr; | 5 | } Clr; |
| 6 | 6 | ||
| 7 | typedef struct { | 7 | typedef struct { |
| 8 | Cursor cursor; | ||
| 9 | } Cur; | ||
| 10 | |||
| 11 | typedef struct { | ||
| 8 | int ascent; | 12 | int ascent; |
| 9 | int descent; | 13 | int descent; |
| 10 | unsigned int h; | 14 | unsigned int h; |
| @@ -13,22 +17,25 @@ typedef struct { | |||
| 13 | } Fnt; | 17 | } Fnt; |
| 14 | 18 | ||
| 15 | typedef struct { | 19 | typedef struct { |
| 20 | Clr *fg; | ||
| 21 | Clr *bg; | ||
| 22 | Clr *border; | ||
| 23 | } Theme; | ||
| 24 | |||
| 25 | typedef struct { | ||
| 16 | unsigned int w, h; | 26 | unsigned int w, h; |
| 17 | Display *dpy; | 27 | Display *dpy; |
| 18 | int screen; | 28 | int screen; |
| 19 | Window win; | 29 | Window root; |
| 20 | Drawable drwable; | 30 | Drawable drawable; |
| 21 | GC gc; | 31 | GC gc; |
| 22 | Clr *fg; | 32 | Theme *theme; |
| 23 | Clr *bg; | ||
| 24 | Fnt *font; | 33 | Fnt *font; |
| 25 | } Drw; | 34 | } Drw; |
| 26 | 35 | ||
| 27 | typedef struct { | 36 | typedef struct { |
| 28 | unsigned int w; | 37 | unsigned int w; |
| 29 | unsigned int h; | 38 | unsigned int h; |
| 30 | int xOff; | ||
| 31 | int yOff; | ||
| 32 | } Extnts; | 39 | } Extnts; |
| 33 | 40 | ||
| 34 | /* Drawable abstraction */ | 41 | /* Drawable abstraction */ |
| @@ -37,25 +44,26 @@ void drw_resize(Drw *drw, unsigned int w, unsigned int h); | |||
| 37 | void drw_free(Drw *drw); | 44 | void drw_free(Drw *drw); |
| 38 | 45 | ||
| 39 | /* Fnt abstraction */ | 46 | /* Fnt abstraction */ |
| 40 | Fnt *drw_font_create(Drw *drw, const char *fontname); | 47 | Fnt *drw_font_create(Display *dpy, const char *fontname); |
| 41 | void drw_font_free(Drw *drw, Fnt *font); | 48 | void drw_font_free(Display *dpy, Fnt *font); |
| 49 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *extnts); | ||
| 50 | unsigned int drw_font_getexts_width(Fnt *font, const char *text, unsigned int len); | ||
| 42 | 51 | ||
| 43 | /* Clrour abstraction */ | 52 | /* Colour abstraction */ |
| 44 | Clr *drw_clr_create(Drw *drw, const char *clrname); | 53 | Clr *drw_clr_create(Drw *drw, const char *clrname); |
| 45 | void drw_clr_free(Drw *drw, Clr *clr); | 54 | void drw_clr_free(Clr *clr); |
| 55 | |||
| 56 | /* Cursor abstraction */ | ||
| 57 | Cur *drw_cur_create(Drw *drw, int shape); | ||
| 58 | void drw_cur_free(Drw *drw, Cur *cursor); | ||
| 46 | 59 | ||
| 47 | /* Drawing context manipulation */ | 60 | /* Drawing context manipulation */ |
| 48 | void drw_setfont(Drw *drw, Fnt *font); | 61 | void drw_setfont(Drw *drw, Fnt *font); |
| 49 | void drw_setfg(Drw *drw, Clr *clr); | 62 | void drw_settheme(Drw *drw, Theme *theme); |
| 50 | void drw_setbg(Drw *drw, Clr *clr); | ||
| 51 | 63 | ||
| 52 | /* Drawing functions */ | 64 | /* Drawing functions */ |
| 53 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, Bool filled, Bool empty, Bool invert); | 65 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert); |
| 54 | void drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, Bool invert); | 66 | void drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert); |
| 55 | 67 | ||
| 56 | /* Map functions */ | 68 | /* Map functions */ |
| 57 | void drw_map(Drw *drw, int x, int y, unsigned int w, unsigned int h); | 69 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); |
| 58 | |||
| 59 | /* Text functions */ | ||
| 60 | void drw_getexts(Drw *drw, const char *text, unsigned int len, Extnts *extnts); | ||
| 61 | |||
