| @@ -93,7 +93,7 @@ const char* win_res(XrmDatabase db, const char *name, const char *def) |
| 93 | 93 | | void win_init(win_t *win) |
| 94 | 94 | | { |
| 95 | 95 | | win_env_t *e; |
| 96 | | − | const char *bg, *fg, *f; |
| 96 | + | const char *win_bg, *win_fg, *bar_bg, *bar_fg, *f; |
| 97 | 97 | | char *res_man; |
| 98 | 98 | | XrmDatabase db; |
| 99 | 99 | | XVisualInfo vis; |
| @@ -133,10 +133,14 @@ void win_init(win_t *win) |
| 133 | 133 | | f = win_res(db, RES_CLASS ".font", "monospace-8"); |
| 134 | 134 | | win_init_font(e, f); |
| 135 | 135 | | |
| 136 | | − | bg = win_res(db, RES_CLASS ".background", "white"); |
| 137 | | − | fg = win_res(db, RES_CLASS ".foreground", "black"); |
| 138 | | − | win_alloc_color(e, bg, &win->bg); |
| 139 | | − | win_alloc_color(e, fg, &win->fg); |
| 136 | + | win_bg = win_res(db, RES_CLASS ".window.background", "white"); |
| 137 | + | win_fg = win_res(db, RES_CLASS ".window.foreground", "black"); |
| 138 | + | bar_bg = win_res(db, RES_CLASS ".bar.background", win_bg); |
| 139 | + | bar_fg = win_res(db, RES_CLASS ".bar.foreground", win_fg); |
| 140 | + | win_alloc_color(e, win_bg, &win->win_bg); |
| 141 | + | win_alloc_color(e, win_fg, &win->win_fg); |
| 142 | + | win_alloc_color(e, bar_bg, &win->bar_bg); |
| 143 | + | win_alloc_color(e, bar_fg, &win->bar_fg); |
| 140 | 144 | | |
| 141 | 145 | | win->bar.l.size = BAR_L_LEN; |
| 142 | 146 | | win->bar.r.size = BAR_R_LEN; |
| @@ -297,7 +301,7 @@ void win_open(win_t *win) |
| 297 | 301 | | win->buf.h = e->scrh; |
| 298 | 302 | | win->buf.pm = XCreatePixmap(e->dpy, win->xwin, |
| 299 | 303 | | win->buf.w, win->buf.h, e->depth); |
| 300 | | − | XSetForeground(e->dpy, gc, win->bg.pixel); |
| 304 | + | XSetForeground(e->dpy, gc, win->win_bg.pixel); |
| 301 | 305 | | XFillRectangle(e->dpy, win->buf.pm, gc, 0, 0, win->buf.w, win->buf.h); |
| 302 | 306 | | XSetWindowBackgroundPixmap(e->dpy, win->xwin, win->buf.pm); |
| 303 | 307 | | |
| @@ -379,7 +383,7 @@ void win_clear(win_t *win) |
| 379 | 383 | | win->buf.pm = XCreatePixmap(e->dpy, win->xwin, |
| 380 | 384 | | win->buf.w, win->buf.h, e->depth); |
| 381 | 385 | | } |
| 382 | | − | XSetForeground(e->dpy, gc, win->bg.pixel); |
| 386 | + | XSetForeground(e->dpy, gc, win->win_bg.pixel); |
| 383 | 387 | | XFillRectangle(e->dpy, win->buf.pm, gc, 0, 0, win->buf.w, win->buf.h); |
| 384 | 388 | | } |
| 385 | 389 | | |
| @@ -436,23 +440,23 @@ void win_draw_bar(win_t *win) |
| 436 | 440 | | d = XftDrawCreate(e->dpy, win->buf.pm, e->vis, |
| 437 | 441 | | e->cmap); |
| 438 | 442 | | |
| 439 | | − | XSetForeground(e->dpy, gc, win->fg.pixel); |
| 443 | + | XSetForeground(e->dpy, gc, win->bar_bg.pixel); |
| 440 | 444 | | XFillRectangle(e->dpy, win->buf.pm, gc, 0, win->h, win->w, win->bar.h); |
| 441 | 445 | | |
| 442 | | − | XSetForeground(e->dpy, gc, win->bg.pixel); |
| 443 | | − | XSetBackground(e->dpy, gc, win->fg.pixel); |
| 446 | + | XSetForeground(e->dpy, gc, win->win_bg.pixel); |
| 447 | + | XSetBackground(e->dpy, gc, win->bar_bg.pixel); |
| 444 | 448 | | |
| 445 | 449 | | if ((len = strlen(r->buf)) > 0) { |
| 446 | 450 | | if ((tw = TEXTWIDTH(win, r->buf, len)) > w) |
| 447 | 451 | | return; |
| 448 | 452 | | x = win->w - tw - H_TEXT_PAD; |
| 449 | 453 | | w -= tw; |
| 450 | | − | win_draw_text(win, d, &win->bg, x, y, r->buf, len, tw); |
| 454 | + | win_draw_text(win, d, &win->bar_fg, x, y, r->buf, len, tw); |
| 451 | 455 | | } |
| 452 | 456 | | if ((len = strlen(l->buf)) > 0) { |
| 453 | 457 | | x = H_TEXT_PAD; |
| 454 | 458 | | w -= 2 * H_TEXT_PAD; /* gap between left and right parts */ |
| 455 | | − | win_draw_text(win, d, &win->bg, x, y, l->buf, len, w); |
| 459 | + | win_draw_text(win, d, &win->bar_fg, x, y, l->buf, len, w); |
| 456 | 460 | | } |
| 457 | 461 | | XftDrawDestroy(d); |
| 458 | 462 | | } |