wmix: moved the initialisation of the config to the related file
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
parent
eb8be92aa8
commit
b394e0bdba
|
@ -45,6 +45,31 @@
|
||||||
struct _Config config;
|
struct _Config config;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the default values in configuration
|
||||||
|
*/
|
||||||
|
void config_init(void)
|
||||||
|
{
|
||||||
|
char *home;
|
||||||
|
|
||||||
|
memset(&config, 0, sizeof(config));
|
||||||
|
|
||||||
|
/* we can theoretically live without a config file */
|
||||||
|
home = getenv("HOME");
|
||||||
|
if (home) {
|
||||||
|
config.file = calloc(1, strlen(home) + 9);
|
||||||
|
sprintf(config.file, "%s/.wmixrc", home);
|
||||||
|
}
|
||||||
|
|
||||||
|
config.mousewheel = 1;
|
||||||
|
config.scrolltext = 1;
|
||||||
|
config.wheel_button_up = 4;
|
||||||
|
config.wheel_button_down = 5;
|
||||||
|
config.scrollstep = 0.03;
|
||||||
|
config.osd = 1;
|
||||||
|
config.osd_color = strdup("green");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse Command-Line options
|
* Parse Command-Line options
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,5 +33,3 @@ typedef unsigned int bool;
|
||||||
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
|
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
|
||||||
|
|
||||||
#define MAX_DOUBLE_CLICK_TIME 0.5
|
#define MAX_DOUBLE_CLICK_TIME 0.5
|
||||||
#define BUTTON_WHEEL_UP 4
|
|
||||||
#define BUTTON_WHEEL_DOWN 5
|
|
||||||
|
|
|
@ -47,6 +47,9 @@ extern struct _Config {
|
||||||
/* Current version of WMixer */
|
/* Current version of WMixer */
|
||||||
#define VERSION "3.0"
|
#define VERSION "3.0"
|
||||||
|
|
||||||
|
/* Sets the default values in the config */
|
||||||
|
void config_init(void);
|
||||||
|
|
||||||
/* Sets configuration from command line */
|
/* Sets configuration from command line */
|
||||||
void parse_cli_options(int argc, char **argv);
|
void parse_cli_options(int argc, char **argv);
|
||||||
|
|
||||||
|
|
20
wmix/wmix.c
20
wmix/wmix.c
|
@ -61,26 +61,8 @@ static void motion_event(XMotionEvent *event);
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
char *home;
|
|
||||||
|
|
||||||
memset(&config, 0, sizeof(config));
|
|
||||||
|
|
||||||
/* we can theoretically live without a config file */
|
|
||||||
home = getenv("HOME");
|
|
||||||
if (home) {
|
|
||||||
config.file = calloc(1, strlen(home) + 9);
|
|
||||||
sprintf(config.file, "%s/.wmixrc", home);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* default values */
|
|
||||||
config.mousewheel = 1;
|
|
||||||
config.scrolltext = 1;
|
|
||||||
config.wheel_button_up = 4;
|
|
||||||
config.wheel_button_down = 5;
|
|
||||||
config.scrollstep = 0.03;
|
|
||||||
config.osd = 1;
|
|
||||||
config.osd_color = strdup("green");
|
|
||||||
|
|
||||||
|
config_init();
|
||||||
parse_cli_options(argc, argv);
|
parse_cli_options(argc, argv);
|
||||||
config_read();
|
config_read();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue