From: Christophe CURIS <[email protected]>

Signed-off-by: Christophe CURIS <[email protected]>
---
 wmix/config.c         | 25 +++++++++++++++++++++++++
 wmix/include/common.h |  2 --
 wmix/include/config.h |  3 +++
 wmix/wmix.c           | 20 +-------------------
 4 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/wmix/config.c b/wmix/config.c
index 8a0419c..9252657 100644
--- a/wmix/config.c
+++ b/wmix/config.c
@@ -46,6 +46,31 @@ 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
  *
  * Supposed to be called before reading config file, as there's an
diff --git a/wmix/include/common.h b/wmix/include/common.h
index 4fdc857..8d9b303 100644
--- a/wmix/include/common.h
+++ b/wmix/include/common.h
@@ -33,5 +33,3 @@ typedef unsigned int bool;
 #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) 
: (x)))
 
 #define MAX_DOUBLE_CLICK_TIME 0.5
-#define BUTTON_WHEEL_UP 4
-#define BUTTON_WHEEL_DOWN 5
diff --git a/wmix/include/config.h b/wmix/include/config.h
index 71a79d4..72e4cc4 100644
--- a/wmix/include/config.h
+++ b/wmix/include/config.h
@@ -47,6 +47,9 @@ extern struct _Config {
 /* Current version of WMixer */
 #define VERSION "3.0"
 
+/* Sets the default values in the config */
+void config_init(void);
+
 /* Sets configuration from command line */
 void parse_cli_options(int argc, char **argv);
 
diff --git a/wmix/wmix.c b/wmix/wmix.c
index 94b3422..e8cb6c6 100644
--- a/wmix/wmix.c
+++ b/wmix/wmix.c
@@ -61,26 +61,8 @@ static void motion_event(XMotionEvent *event);
 int main(int argc, char **argv)
 {
     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);
     config_read();
 
-- 
1.9.2


-- 
To unsubscribe, send mail to [email protected].

Reply via email to