summaryrefslogtreecommitdiffstats
path: root/compton.c
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2012-09-28 09:10:34 +0800
committerRichard Grenville <pyxlcy@gmail.com>2012-09-28 09:19:53 +0800
commitdebc0035cd5cc315e6fe5941e9b36e1eb3548f5f (patch)
tree24446437eeaae3d2556481dd3aa49fed0d942dd2 /compton.c
parent4deb30a903f7be941f0aacab25f2ec285e815325 (diff)
downloadtdebase-debc0035cd5cc315e6fe5941e9b36e1eb3548f5f.tar.gz
tdebase-debc0035cd5cc315e6fe5941e9b36e1eb3548f5f.zip
Bug fix: #48: Compilation failure with old libconfig/libpcre
- Fix compilation failure with <libpcre-8.20 and <libconfig-1.4. Tested with libpcre-8.12 and libconfig-1.3.2, but not extensively tested. libconfig-1.3* probably has more limitations on configuration file syntax (enforces comma at the end of a setting?) and does not support @include. - Make it possible to turn off PCRE and libconfig support using environment variable "CFG". Not well tested. CMake might provide a better solution.
Diffstat (limited to 'compton.c')
-rw-r--r--compton.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/compton.c b/compton.c
index b9c3e96a1..d4621803b 100644
--- a/compton.c
+++ b/compton.c
@@ -3071,7 +3071,7 @@ open_config_file(char *cpath, char **ppath) {
*/
static void
parse_config(char *cpath, struct options_tmp *pcfgtmp) {
- char *path = NULL, *parent = NULL;
+ char *path = NULL;
FILE *f;
config_t cfg;
int ival = 0;
@@ -3085,9 +3085,11 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) {
}
config_init(&cfg);
- parent = dirname(path);
+#ifndef CONFIG_LIBCONFIG_LEGACY
+ char *parent = dirname(path);
if (parent)
config_set_include_dir(&cfg, parent);
+#endif
if (CONFIG_FALSE == config_read(&cfg, f)) {
printf("Error when reading configuration file \"%s\", line %d: %s\n",
@@ -3104,7 +3106,7 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) {
// right now. It will be done later
// -D (fade_delta)
- if (config_lookup_int(&cfg, "fade-delta", &ival))
+ if (lcfg_lookup_int(&cfg, "fade-delta", &ival))
opts.fade_delta = ival;
// -I (fade_in_step)
if (config_lookup_float(&cfg, "fade-in-step", &dval))
@@ -3113,13 +3115,13 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) {
if (config_lookup_float(&cfg, "fade-out-step", &dval))
opts.fade_out_step = normalize_d(dval) * OPAQUE;
// -r (shadow_radius)
- config_lookup_int(&cfg, "shadow-radius", &opts.shadow_radius);
+ lcfg_lookup_int(&cfg, "shadow-radius", &opts.shadow_radius);
// -o (shadow_opacity)
config_lookup_float(&cfg, "shadow-opacity", &opts.shadow_opacity);
// -l (shadow_offset_x)
- config_lookup_int(&cfg, "shadow-offset-x", &opts.shadow_offset_x);
+ lcfg_lookup_int(&cfg, "shadow-offset-x", &opts.shadow_offset_x);
// -t (shadow_offset_y)
- config_lookup_int(&cfg, "shadow-offset-y", &opts.shadow_offset_y);
+ lcfg_lookup_int(&cfg, "shadow-offset-y", &opts.shadow_offset_y);
// -i (inactive_opacity)
if (config_lookup_float(&cfg, "inactive-opacity", &dval))
opts.inactive_opacity = normalize_d(dval) * OPAQUE;