void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
{
+ int col = ColFg;
+
if (!drw || !drw->scheme)
return;
- XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
+
+ if (invert == 1) col = ColBg;
+ if (invert == 2) col = ColAccent;
+
+ XSetForeground(drw->dpy, drw->gc, drw->scheme[col].pixel);
if (filled)
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
else
if (!render) {
w = ~w;
} else {
- XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
- XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
+ XSetForeground(drw->dpy, drw->gc, drw->scheme[invert == 1 ? ColFg : ColBg].pixel);
+ // XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
if (render) {
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
- XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
+ XftDrawStringUtf8(d, &drw->scheme[invert == 1 ? ColBg : ColFg],
usedfont->xfont, x, ty, (XftChar8 *)buf, len);
}
x += ew;
typedef struct {
unsigned int linecount;
char **lines;
- int *invert;
+ int *colors;
Image *img;
char *embed;
int imagesplit;
static size_t size = 0;
size_t blen, maxlines;
char buf[BUFSIZ], *p;
- int inverted;
+ int colorset;
Slide *s;
/* read each line from fp and add it to the item list */
continue;
blen = strlen(buf);
- inverted = 0;
- if (buf[0] == '$') {
- inverted = 1;
+ switch (buf[0]) {
+ case '$': colorset = 1; goto shiftbuf;
+ case '%': colorset = 2; goto shiftbuf;
+ default: colorset = 0; break;
+ shiftbuf:
blen -= 1;
memmove(buf, buf + 1, blen);
buf[blen] = '\0';
maxlines = 2 * s->linecount + 1;
if (!(s->lines = realloc(s->lines, maxlines * sizeof(s->lines[0]))))
die("sent: Unable to reallocate %u bytes:", maxlines * sizeof(s->lines[0]));
- if (!(s->invert = realloc(s->invert, maxlines * sizeof(s->invert[0]))))
- die("sent: Unable to reallocate %u bytes:", maxlines * sizeof(s->invert[0]));
+ if (!(s->colors = realloc(s->colors, maxlines * sizeof(s->colors[0]))))
+ die("sent: Unable to reallocate %u bytes:", maxlines * sizeof(s->colors[0]));
}
- s->invert[s->linecount] = inverted;
+ s->colors[s->linecount] = colorset;
if (!(s->lines[s->linecount] = strdup(buf)))
die("sent: Unable to strdup:");
if (!im) {
drw_rect(d, 0, 0, xw.w, xw.h, 1, 1);
for (i = 0; i < slides[idx].linecount; i++) {
- if (slides[idx].invert[i]) {
+ if (slides[idx].colors[i]) {
drw_rect(d,
0,
- (xw.h - height) / 2 + i * linespacing * d->fonts->h,
+ (xw.h - height) / 2 + (i * linespacing - 0.125f) * d->fonts->h,
xw.w,
- floor(d->fonts->h * (((i < slides[idx].linecount - 1) && slides[idx].invert[i + 1] != 0) ? linespacing : 1) + 0.5),
- 1, 0);
+ // floor(d->fonts->h * (((i < slides[idx].linecount - 1) && slides[idx].colors[i + 1] != 0) ? linespacing : 1) + 0.5),
+ d->fonts->h * (linespacing + 0.0625f),
+ 1, slides[idx].colors[i] == 2 ? 2 : 0);
}
-
+ }
+ for (i = 0; i < slides[idx].linecount; i++) {
drw_text(d,
(xw.w - width) / 2,
(xw.h - height) / 2 + i * linespacing * d->fonts->h,
d->fonts->h,
0,
slides[idx].lines[i],
- slides[idx].invert[i]);
+ slides[idx].colors[i] == 1);
}
if (idx != 0 && progressheight != 0) {
drw_rect(d,
if (!(d = drw_create(xw.dpy, xw.scr, xw.win, xw.w, xw.h)))
die("sent: Unable to create drawing context");
if (use_inverted_colors) {
- sc = drw_scm_create(d, inverted_colors, 2);
+ sc = drw_scm_create(d, inverted_colors, 3);
} else {
- sc = drw_scm_create(d, colors, 2);
+ sc = drw_scm_create(d, colors, 3);
}
drw_setscheme(d, sc);
XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel);
fontfallbacks[0] = EARGF(usage());
break;
case 'c':
- colors[0] = EARGF(usage());
+ colors[ColFg] = EARGF(usage());
break;
+ case 'a':
+ colors[ColAccent] = EARGF(usage());
+ break;
case 'b':
- colors[1] = EARGF(usage());
+ colors[ColBg] = EARGF(usage());
break;
default:
usage();