From 60f724a30a4814095bb219433f704d099ad46ebb Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Wed, 26 Sep 2012 18:54:35 +0800 Subject: Misc: Code clean-up - Change some members of options_t. Clean up wrongly replaced option names in comments. Rename "options" to "opts", to avoid breaking line width too much, and to minimize typing as it's so frequently used. :-) - Let general options in commandline arguments override wintype-specific options in a configuration file, which could be a more natural behavior. --- compton.h | 60 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 26 deletions(-) (limited to 'compton.h') diff --git a/compton.h b/compton.h index 922f02282..77166a666 100644 --- a/compton.h +++ b/compton.h @@ -242,22 +242,38 @@ typedef struct _win { } win; typedef struct _options { + // General char *display; + /// Whether to try to detect WM windows and mark them as focused. + Bool mark_wmwin_focused; + /// Whether to fork to background. + Bool fork_after_register; + Bool synchronize; + + // Shadow + Bool wintype_shadow[NUM_WINTYPES]; + /// Red, green and blue tone of the shadow. + double shadow_red, shadow_green, shadow_blue; int shadow_radius; - int shadow_offset_x; - int shadow_offset_y; + int shadow_offset_x, shadow_offset_y; double shadow_opacity; + Bool clear_shadow; + /// Shadow blacklist. A linked list of conditions. + wincond *shadow_blacklist; + // Fading + Bool wintype_fade[NUM_WINTYPES]; /// How much to fade in in a single fading step. opacity_t fade_in_step; /// How much to fade out in a single fading step. opacity_t fade_out_step; unsigned long fade_delta; - unsigned long fade_time; Bool fade_trans; + /// Fading blacklist. A linked list of conditions. + wincond *fade_blacklist; - Bool clear_shadow; - + // Opacity + double wintype_opacity[NUM_WINTYPES]; /// Default opacity for inactive windows. /// 32-bit integer with the format of _NET_WM_OPACITY. 0 stands for /// not enabled, default. @@ -269,35 +285,19 @@ typedef struct _options { /// How much to dim an inactive window. 0.0 - 1.0, 0 to disable. double inactive_dim; - /// Whether to try to detect WM windows and mark them as focused. - double mark_wmwin_focused; - + // Calculated /// Whether compton needs to track focus changes. Bool track_focus; /// Whether compton needs to track window name and class. Bool track_wdata; - /// Shadow blacklist. A linked list of conditions. - wincond *shadow_blacklist; - /// Fading blacklist. A linked list of conditions. - wincond *fade_blacklist; - - /// Whether to fork to background. - Bool fork_after_register; - /// Red, green and blue tone of the shadow. - double shadow_red; - double shadow_green; - double shadow_blue; - - Bool synchronize; +} options_t; - // Temporary options - int shadow_enable; - int fading_enable; +struct options_tmp { Bool no_dock_shadow; Bool no_dnd_shadow; double menu_opacity; -} options_t; +}; typedef struct _conv { int size; @@ -918,11 +918,19 @@ static void fork_after(void); #ifdef CONFIG_LIBCONFIG +static void +lcfg_lookup_bool(const config_t *config, const char *path, Bool *value) { + int ival; + + if (config_lookup_bool(config, path, &ival)) + *value = ival; +} + static FILE * open_config_file(char *cpath, char **path); static void -parse_config(char *cpath); +parse_config(char *cpath, struct options_tmp *pcfgtmp); #endif static void -- cgit v1.2.1