config.h: allow all values to be NULL

might as well make things consistent instead of having certain values
that can be NULL and certain that cannot.

some of the default values are still kept in config.h for example
reasons.
This commit is contained in:
NRK 2023-06-23 22:10:27 +06:00
parent 3097037624
commit 6185bcb441
2 changed files with 7 additions and 7 deletions

View File

@ -6,13 +6,13 @@ static const int WIN_HEIGHT = 600;
/* colors and font can be overwritten via X resource properties.
* See nsxiv(1), X(7) section Resources and xrdb(1) for more information.
* X resource default value */
* X resource value (NULL == default) */
static const char *WIN_BG[] = { "Nsxiv.window.background", "white" };
static const char *WIN_FG[] = { "Nsxiv.window.foreground", "black" };
static const char *MARK_FG[] = { "Nsxiv.mark.foreground", NULL }; /* NULL means it will default to window foreground */
static const char *MARK_FG[] = { "Nsxiv.mark.foreground", NULL };
#if HAVE_LIBFONTS
static const char *BAR_BG[] = { "Nsxiv.bar.background", NULL }; /* NULL means it will default to window background */
static const char *BAR_FG[] = { "Nsxiv.bar.foreground", NULL }; /* NULL means it will default to window foreground */
static const char *BAR_BG[] = { "Nsxiv.bar.background", NULL };
static const char *BAR_FG[] = { "Nsxiv.bar.foreground", NULL };
static const char *BAR_FONT[] = { "Nsxiv.bar.font", "monospace-8" };
/* if true, statusbar appears on top of the window */

View File

@ -141,8 +141,8 @@ void win_init(win_t *win)
res_man = XResourceManagerString(e->dpy);
db = res_man == NULL ? NULL : XrmGetStringDatabase(res_man);
win_bg = win_res(db, WIN_BG[0], WIN_BG[1]);
win_fg = win_res(db, WIN_FG[0], WIN_FG[1]);
win_bg = win_res(db, WIN_BG[0], WIN_BG[1] ? WIN_BG[1] : "white");
win_fg = win_res(db, WIN_FG[0], WIN_FG[1] ? WIN_FG[1] : "black");
mrk_fg = win_res(db, MARK_FG[0], MARK_FG[1] ? MARK_FG[1] : win_fg);
win_alloc_color(e, win_bg, &win->win_bg);
win_alloc_color(e, win_fg, &win->win_fg);
@ -154,7 +154,7 @@ void win_init(win_t *win)
xft_alloc_color(e, bar_bg, &win->bar_bg);
xft_alloc_color(e, bar_fg, &win->bar_fg);
f = win_res(db, BAR_FONT[0], BAR_FONT[1]);
f = win_res(db, BAR_FONT[0], BAR_FONT[1] ? BAR_FONT[1] : "monospace-8");
win_init_font(e, f);
win->bar.l.buf = lbuf;