~lh2/sxiv

728b7a6bc6b72a5555cf3bcef0dff6d9082b61bf — Lukas Henkel 3 years ago 1d28627 master
Add separate color configuration for the bar
2 files changed, 10 insertions(+), 4 deletions(-)

M sxiv.h
M window.c
M sxiv.h => sxiv.h +2 -0
@@ 409,6 409,8 @@ struct win {

	XftColor bg;
	XftColor fg;
	XftColor barbg;
	XftColor barfg;

	int x;
	int y;

M window.c => window.c +8 -4
@@ 92,7 92,7 @@ const char* win_res(XrmDatabase db, const char *name, const char *def)
void win_init(win_t *win)
{
	win_env_t *e;
	const char *bg, *fg, *f;
	const char *bg, *fg, *f, *barbg, *barfg;
	char *res_man;
	XrmDatabase db;



@@ 121,8 121,12 @@ void win_init(win_t *win)

	bg = win_res(db, RES_CLASS ".background", "white");
	fg = win_res(db, RES_CLASS ".foreground", "black");
	barbg = win_res(db, RES_CLASS ".backgroundBar", fg);
	barfg = win_res(db, RES_CLASS ".foregroundBar", bg);
	win_alloc_color(e, bg, &win->bg);
	win_alloc_color(e, fg, &win->fg);
	win_alloc_color(e, barbg, &win->barbg);
	win_alloc_color(e, barfg, &win->barfg);

	win->bar.l.size = BAR_L_LEN;
	win->bar.r.size = BAR_R_LEN;


@@ 397,7 401,7 @@ void win_draw_bar(win_t *win)
	d = XftDrawCreate(e->dpy, win->buf.pm, DefaultVisual(e->dpy, e->scr),
	                  DefaultColormap(e->dpy, e->scr));

	XSetForeground(e->dpy, gc, win->fg.pixel);
	XSetForeground(e->dpy, gc, win->barbg.pixel);
	XFillRectangle(e->dpy, win->buf.pm, gc, 0, win->h, win->w, win->bar.h);

	XSetForeground(e->dpy, gc, win->bg.pixel);


@@ 408,12 412,12 @@ void win_draw_bar(win_t *win)
			return;
		x = win->w - tw - H_TEXT_PAD;
		w -= tw;
		win_draw_text(win, d, &win->bg, x, y, r->buf, len, tw);
		win_draw_text(win, d, &win->barfg, x, y, r->buf, len, tw);
	}
	if ((len = strlen(l->buf)) > 0) {
		x = H_TEXT_PAD;
		w -= 2 * H_TEXT_PAD; /* gap between left and right parts */
		win_draw_text(win, d, &win->bg, x, y, l->buf, len, w);
		win_draw_text(win, d, &win->barfg, x, y, l->buf, len, w);
	}
	XftDrawDestroy(d);
}