[hackers] [libsl] incorporated recent drw changes || Anselm R Garbe
commit 96fe0f030abeb962b07ad4fc390ca8ad926bb9aa
Author: Anselm R Garbe <anselm_AT_garbe.us>
Date: Wed Jun 19 19:36:54 2013 +0200
incorporated recent drw changes
diff --git a/drw.c b/drw.c
index 6e5801c..bc4ac41 100644
--- a/drw.c
+++ b/drw.c
_AT_@ -109,9 +109,8 @@ drw_clr_create(Drw *drw, const char *clrname) {
void
drw_clr_free(Clr *clr) {
- if(!clr)
- return;
- free(clr);
+ if(clr)
+ free(clr);
}
void
_AT_@ -121,19 +120,18 @@ drw_setfont(Drw *drw, Fnt *font) {
}
void
-drw_settheme(Drw *drw, Theme *theme) {
- if(!drw || !theme)
- return;
- drw->theme = theme;
+drw_setscheme(Drw *drw, ClrScheme *scheme) {
+ if(drw && scheme)
+ drw->scheme = scheme;
}
void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert) {
int dx;
- if(!drw || !drw->font || !drw->theme)
+ if(!drw || !drw->font || !drw->scheme)
return;
- XSetForeground(drw->dpy, drw->gc, invert ? drw->theme->bg->rgb : drw->theme->fg->rgb);
+ XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->rgb : drw->scheme->fg->rgb);
dx = (drw->font->ascent + drw->font->descent + 2) / 4;
if(filled)
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x+1, y+1, dx+1, dx+1);
_AT_@ -147,9 +145,9 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *tex
int i, tx, ty, th, len, olen;
Extnts tex;
- if(!drw || !drw->theme)
+ if(!drw || !drw->scheme)
return;
- XSetForeground(drw->dpy, drw->gc, invert ? drw->theme->fg->rgb : drw->theme->bg->rgb);
+ XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->fg->rgb : drw->scheme->bg->rgb);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
if(!text || !drw->font)
return;
_AT_@ -166,7 +164,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *tex
memcpy(buf, text, len);
if(len < olen)
for(i = len; i && i > len - 3; buf[--i] = '.');
- XSetForeground(drw->dpy, drw->gc, invert ? drw->theme->bg->rgb : drw->theme->fg->rgb);
+ XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->rgb : drw->scheme->fg->rgb);
if(drw->font->set)
XmbDrawString(drw->dpy, drw->drawable, drw->font->set, drw->gc, tx, ty, buf, len);
else
diff --git a/drw.h b/drw.h
index 764b9e3..a5f34e0 100644
--- a/drw.h
+++ b/drw.h
_AT_@ -20,7 +20,7 @@ typedef struct {
Clr *fg;
Clr *bg;
Clr *border;
-} Theme;
+} ClrScheme;
typedef struct {
unsigned int w, h;
_AT_@ -29,7 +29,7 @@ typedef struct {
Window root;
Drawable drawable;
GC gc;
- Theme *theme;
+ ClrScheme *scheme;
Fnt *font;
} Drw;
_AT_@ -59,7 +59,7 @@ void drw_cur_free(Drw *drw, Cur *cursor);
/* Drawing context manipulation */
void drw_setfont(Drw *drw, Fnt *font);
-void drw_settheme(Drw *drw, Theme *theme);
+void drw_setscheme(Drw *drw, ClrScheme *scheme);
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert);
Received on Wed Jun 19 2013 - 19:37:10 CEST
This archive was generated by hypermail 2.3.0
: Wed Jun 19 2013 - 19:48:20 CEST