Declare foreground and background variables global
Removes the need to pass the terminal's default background color round. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
e5dee68dcf
commit
1355bad264
@ -916,7 +916,7 @@ parse_args (int argc, char **argv, struct conf *conf)
|
||||
io_check_file (path_apts, (int *)0);
|
||||
io_check_file (path_conf, (int *)0);
|
||||
io_load_app ();
|
||||
custom_load_conf (conf, 0); /* To get output date format. */
|
||||
custom_load_conf (conf); /* To get output date format. */
|
||||
if (dflag)
|
||||
date_arg (ddate, add_line, Nflag, conf, preg);
|
||||
if (rflag || sflag)
|
||||
@ -931,7 +931,7 @@ parse_args (int argc, char **argv, struct conf *conf)
|
||||
io_check_file (path_apts, (int *)0);
|
||||
io_check_file (path_conf, (int *)0);
|
||||
vars_init (conf);
|
||||
custom_load_conf (conf, 0); /* To get output date format. */
|
||||
custom_load_conf (conf); /* To get output date format. */
|
||||
io_load_app ();
|
||||
day.dd = day.mm = day.yyyy = 0;
|
||||
(void)app_arg (add_line, &day, 0, Nflag, conf, preg);
|
||||
|
@ -50,7 +50,6 @@ main (int argc, char **argv)
|
||||
{
|
||||
struct conf conf;
|
||||
struct day_items_nb inday;
|
||||
int background, foreground;
|
||||
int non_interactive;
|
||||
int no_data_file = 1;
|
||||
int sav_hilt_app = 0;
|
||||
@ -148,7 +147,7 @@ main (int argc, char **argv)
|
||||
* configuration (the display is then updated), and then
|
||||
* the todo list, appointments and events.
|
||||
*/
|
||||
custom_load_conf (&conf, background);
|
||||
custom_load_conf (&conf);
|
||||
wins_erase_status_bar ();
|
||||
io_load_keys (conf.pager);
|
||||
io_load_todo ();
|
||||
|
@ -611,7 +611,7 @@ char *calendar_get_pom (time_t);
|
||||
void custom_init_attr (void);
|
||||
void custom_apply_attr (WINDOW *, int);
|
||||
void custom_remove_attr (WINDOW *, int);
|
||||
void custom_load_conf (struct conf *, int);
|
||||
void custom_load_conf (struct conf *);
|
||||
void custom_config_bar (void);
|
||||
void custom_layout_config (void);
|
||||
void custom_sidebar_config (void);
|
||||
@ -892,6 +892,7 @@ void press_any_key (void);
|
||||
extern int col, row;
|
||||
extern int resize;
|
||||
extern unsigned colorize;
|
||||
extern int foreground, background;
|
||||
extern enum ui_mode ui_mode;
|
||||
extern int days[12];
|
||||
extern char *monthnames[12];
|
||||
|
12
src/custom.c
12
src/custom.c
@ -113,7 +113,7 @@ conf_parse_int (int *dest, char *val)
|
||||
* differently (number between 1 and 8).
|
||||
*/
|
||||
static void
|
||||
custom_load_color (char *color, int background)
|
||||
custom_load_color (char *color)
|
||||
{
|
||||
#define AWAITED_COLORS 2
|
||||
|
||||
@ -255,7 +255,7 @@ custom_remove_attr (WINDOW *win, int attr_num)
|
||||
|
||||
/* Set a configuration variable. */
|
||||
static void
|
||||
custom_set_conf (struct conf *conf, int background, enum conf_var var, char *val)
|
||||
custom_set_conf (struct conf *conf, enum conf_var var, char *val)
|
||||
{
|
||||
unsigned tmp;
|
||||
|
||||
@ -290,7 +290,7 @@ custom_set_conf (struct conf *conf, int background, enum conf_var var, char *val
|
||||
calendar_set_first_day_of_week (SUNDAY);
|
||||
break;
|
||||
case CUSTOM_CONF_COLORTHEME:
|
||||
custom_load_color (val, background);
|
||||
custom_load_color (val);
|
||||
break;
|
||||
case CUSTOM_CONF_LAYOUT:
|
||||
wins_set_layout (atoi (val));
|
||||
@ -333,7 +333,7 @@ custom_set_conf (struct conf *conf, int background, enum conf_var var, char *val
|
||||
|
||||
/* Load the user configuration. */
|
||||
void
|
||||
custom_load_conf (struct conf *conf, int background)
|
||||
custom_load_conf (struct conf *conf)
|
||||
{
|
||||
FILE *data_file;
|
||||
char *mesg_line1 = _("Failed to open config file");
|
||||
@ -413,10 +413,10 @@ custom_load_conf (struct conf *conf, int background)
|
||||
if (fgets (buf, sizeof buf, data_file) == NULL)
|
||||
break;
|
||||
io_extract_data (e_conf, buf, sizeof buf);
|
||||
custom_set_conf (conf, background, var, e_conf);
|
||||
custom_set_conf (conf, var, e_conf);
|
||||
}
|
||||
else
|
||||
custom_set_conf (conf, background, var, val);
|
||||
custom_set_conf (conf, var, val);
|
||||
}
|
||||
file_close (data_file, __FILE_POS__);
|
||||
pthread_mutex_unlock (&nbar.mutex);
|
||||
|
@ -165,7 +165,7 @@ dmon_start (int parent_exit_status)
|
||||
if (!io_file_exist (path_conf))
|
||||
DMON_ABRT (_("Could not access \"%s\": %s\n"),
|
||||
path_conf, strerror (errno));
|
||||
custom_load_conf (&conf, 0);
|
||||
custom_load_conf (&conf);
|
||||
|
||||
if (!io_file_exist (path_apts))
|
||||
DMON_ABRT (_("Could not access \"%s\": %s\n"),
|
||||
|
@ -48,6 +48,9 @@ int resize = 0;
|
||||
/* variable to tell if the terminal supports color */
|
||||
unsigned colorize = 0;
|
||||
|
||||
/* Default background and foreground colors. */
|
||||
int foreground, background;
|
||||
|
||||
/*
|
||||
* To tell if curses interface was launched already or not (in that case
|
||||
* calcurse is running in command-line mode).
|
||||
|
Loading…
x
Reference in New Issue
Block a user