however renamed theme into scheme resp. Theme into ClrScheme
void
drw_clr_free(Clr *clr) {
void
drw_clr_free(Clr *clr) {
- if(!clr)
- return;
- free(clr);
-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;
}
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)
- 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);
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);
int i, tx, ty, th, len, olen;
Extnts tex;
int i, tx, ty, th, len, olen;
Extnts tex;
- if(!drw || !drw->theme)
+ if(!drw || !drw->scheme)
- 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;
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
if(!text || !drw->font)
return;
memcpy(buf, text, len);
if(len < olen)
for(i = len; i && i > len - 3; buf[--i] = '.');
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
if(drw->font->set)
XmbDrawString(drw->dpy, drw->drawable, drw->font->set, drw->gc, tx, ty, buf, len);
else
Clr *fg;
Clr *bg;
Clr *border;
Clr *fg;
Clr *bg;
Clr *border;
typedef struct {
unsigned int w, h;
typedef struct {
unsigned int w, h;
Window root;
Drawable drawable;
GC gc;
Window root;
Drawable drawable;
GC gc;
/* Drawing context manipulation */
void drw_setfont(Drw *drw, Fnt *font);
/* 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);
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert);
#define TEXTW(X) (drw_font_getexts_width(drw->font, X, strlen(X)) + drw->font->h)
/* enums */
#define TEXTW(X) (drw_font_getexts_width(drw->font, X, strlen(X)) + drw->font->h)
/* enums */
-enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
+enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
enum { NetSupported, NetWMName, NetWMState,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
- ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
static Atom wmatom[WMLast], netatom[NetLast];
static Bool running = True;
static Cur *cursor[CurLast];
static Atom wmatom[WMLast], netatom[NetLast];
static Bool running = True;
static Cur *cursor[CurLast];
-static Theme thmnorm[ColLast];
-static Theme thmsel[ColLast];
+static ClrScheme scheme[SchemeLast];
static Display *dpy;
static Drw *drw;
static Fnt *fnt;
static Display *dpy;
static Drw *drw;
static Fnt *fnt;
drw_cur_free(drw, cursor[CurResize]);
drw_cur_free(drw, cursor[CurMove]);
drw_font_free(dpy, fnt);
drw_cur_free(drw, cursor[CurResize]);
drw_cur_free(drw, cursor[CurMove]);
drw_font_free(dpy, fnt);
- drw_clr_free(thmnorm->border);
- drw_clr_free(thmnorm->bg);
- drw_clr_free(thmnorm->fg);
- drw_clr_free(thmsel->border);
- drw_clr_free(thmsel->bg);
- drw_clr_free(thmsel->fg);
+ drw_clr_free(scheme[SchemeNorm].border);
+ drw_clr_free(scheme[SchemeNorm].bg);
+ drw_clr_free(scheme[SchemeNorm].fg);
+ drw_clr_free(scheme[SchemeSel].border);
+ drw_clr_free(scheme[SchemeSel].bg);
+ drw_clr_free(scheme[SchemeSel].fg);
drw_free(drw);
XSync(dpy, False);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
drw_free(drw);
XSync(dpy, False);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
x = 0;
for(i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
x = 0;
for(i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
- drw_settheme(drw, m->tagset[m->seltags] & 1 << i ? thmsel : thmnorm);
+ drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
drw_rect(drw, x, 0, w, bh, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
occ & 1 << i, urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
drw_rect(drw, x, 0, w, bh, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
occ & 1 << i, urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
- drw_settheme(drw, thmnorm);
+ drw_setscheme(drw, &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
x += w;
xx = x;
drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
x += w;
xx = x;
if((w = x - xx) > bh) {
x = xx;
if(m->sel) {
if((w = x - xx) > bh) {
x = xx;
if(m->sel) {
- drw_settheme(drw, m == selmon ? thmsel : thmnorm);
+ drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, m->sel->name, 0);
drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0);
}
else {
drw_text(drw, x, 0, w, bh, m->sel->name, 0);
drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0);
}
else {
- drw_settheme(drw, thmnorm);
+ drw_setscheme(drw, &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, NULL, 0);
}
}
drw_text(drw, x, 0, w, bh, NULL, 0);
}
}
detachstack(c);
attachstack(c);
grabbuttons(c, True);
detachstack(c);
attachstack(c);
grabbuttons(c, True);
- XSetWindowBorder(dpy, c->win, thmsel->border->rgb);
+ XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->rgb);
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
- XSetWindowBorder(dpy, w, thmnorm->border->rgb);
+ XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->rgb);
configure(c); /* propagates border_width, if size doesn't change */
updatewindowtype(c);
updatesizehints(c);
configure(c); /* propagates border_width, if size doesn't change */
updatewindowtype(c);
updatesizehints(c);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
- thmnorm->border = drw_clr_create(drw, normbordercolor);
- thmnorm->bg = drw_clr_create(drw, normbgcolor);
- thmnorm->fg = drw_clr_create(drw, normfgcolor);
- thmsel->border = drw_clr_create(drw, selbordercolor);
- thmsel->bg = drw_clr_create(drw, selbgcolor);
- thmsel->fg = drw_clr_create(drw, selfgcolor);
+ scheme[SchemeNorm].border = drw_clr_create(drw, normbordercolor);
+ scheme[SchemeNorm].bg = drw_clr_create(drw, normbgcolor);
+ scheme[SchemeNorm].fg = drw_clr_create(drw, normfgcolor);
+ scheme[SchemeSel].border = drw_clr_create(drw, selbordercolor);
+ scheme[SchemeSel].bg = drw_clr_create(drw, selbgcolor);
+ scheme[SchemeSel].fg = drw_clr_create(drw, selfgcolor);
/* init bars */
updatebars();
updatestatus();
/* init bars */
updatebars();
updatestatus();
if(!c)
return;
grabbuttons(c, False);
if(!c)
return;
grabbuttons(c, False);
- XSetWindowBorder(dpy, c->win, thmnorm->border->rgb);
+ XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->rgb);
if(setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
if(setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);