diff --git a/Makefile b/Makefile index 7d62596..47be594 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,12 @@ INCS += $(shell pcre-config --cflags) CFLAGS += -Wall -std=c99 OBJS = compton.o +CFG ?= -DCONFIG_LIBCONFIG -DCONFIG_REGEX_PCRE -DCONFIG_REGEX_PCRE_JIT +# libconfig-1.3* does not define LIBCONFIG_VER* macros, so we use pkg-config +# to determine its version here +CFG += $(shell pkg-config --atleast-version=1.4 libconfig || echo '-DCONFIG_LIBCONFIG_LEGACY') +CFLAGS += $(CFG) + %.o: src/%.c src/%.h $(CC) $(CFLAGS) $(INCS) -c src/$*.c diff --git a/compton.sample.conf b/compton.sample.conf index d7c11b6..22a5667 100644 --- a/compton.sample.conf +++ b/compton.sample.conf @@ -3,13 +3,13 @@ shadow = true; no-dnd-shadow = true; no-dock-shadow = true; clear-shadow = true; -shadow-radius = 7 -shadow-offset-x = -7 -shadow-offset-y = -7 -# shadow-opacity = 0.7 -# shadow-red = 0.0 -# shadow-green = 0.0 -# shadow-blue = 0.0 +shadow-radius = 7; +shadow-offset-x = -7; +shadow-offset-y = -7; +# shadow-opacity = 0.7; +# shadow-red = 0.0; +# shadow-green = 0.0; +# shadow-blue = 0.0; shadow-exclude = [ "n:e:Notification" ]; # shadow-exclude = "n:e:Notification"; @@ -21,9 +21,9 @@ inactive-opacity-override = true; # Fading fading = true; -# fade-delta = 30 -fade-in-step = 0.03 -fade-out-step = 0.03 +# fade-delta = 30; +fade-in-step = 0.03; +fade-out-step = 0.03; # no-fading-openclose = true; # Other @@ -34,4 +34,4 @@ mark-ovredir-focused = true; wintypes: { tooltip = { fade = true; shadow = false; opacity = 0.75; }; -} +}; diff --git a/src/compton.c b/src/compton.c index b9c3e96..d462180 100644 --- a/src/compton.c +++ b/src/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; diff --git a/src/compton.h b/src/compton.h index 0c6457c..51118e8 100644 --- a/src/compton.h +++ b/src/compton.h @@ -20,12 +20,12 @@ // Whether to enable PCRE regular expression support in blacklists, enabled // by default -#define CONFIG_REGEX_PCRE 1 +// #define CONFIG_REGEX_PCRE 1 // Whether to enable JIT support of libpcre. This may cause problems on PaX // kernels. -#define CONFIG_REGEX_PCRE_JIT 1 +// #define CONFIG_REGEX_PCRE_JIT 1 // Whether to enable parsing of configuration files using libconfig -#define CONFIG_LIBCONFIG 1 +// #define CONFIG_LIBCONFIG 1 // === Includes === @@ -49,6 +49,12 @@ #ifdef CONFIG_REGEX_PCRE #include + +// For compatiblity with