From 6185bcb441ac6c2f5c1e94c5f15e9dd678418e56 Mon Sep 17 00:00:00 2001 From: NRK Date: Fri, 23 Jun 2023 22:10:27 +0600 Subject: [PATCH] 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. --- config.def.h | 8 ++++---- window.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config.def.h b/config.def.h index c49a5eb..7fbfb17 100644 --- a/config.def.h +++ b/config.def.h @@ -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 */ diff --git a/window.c b/window.c index 8b513bd..387d789 100644 --- a/window.c +++ b/window.c @@ -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;