mirror of
https://github.com/yshui/picom.git
synced 2024-11-03 04:33:49 -05:00
config_libconfig: address some clang-tidy issues, run clang-format
This commit is contained in:
parent
bd47a47275
commit
d03cb4ea24
1 changed files with 25 additions and 12 deletions
|
@ -73,8 +73,9 @@ FILE *open_config_file(const char *cpath, char **ppath) {
|
||||||
|
|
||||||
if (cpath) {
|
if (cpath) {
|
||||||
FILE *ret = fopen(cpath, "r");
|
FILE *ret = fopen(cpath, "r");
|
||||||
if (ret && ppath)
|
if (ret && ppath) {
|
||||||
*ppath = strdup(cpath);
|
*ppath = strdup(cpath);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,10 +125,11 @@ void parse_cfg_condlst(const config_t *pcfg, c2_lptr_t **pcondlst, const char *n
|
||||||
// Parse an array of options
|
// Parse an array of options
|
||||||
if (config_setting_is_array(setting)) {
|
if (config_setting_is_array(setting)) {
|
||||||
int i = config_setting_length(setting);
|
int i = config_setting_length(setting);
|
||||||
while (i--)
|
while (i--) {
|
||||||
condlst_add(pcondlst,
|
condlst_add(pcondlst,
|
||||||
config_setting_get_string_elem(setting, i));
|
config_setting_get_string_elem(setting, i));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Treat it as a single pattern if it's a string
|
// Treat it as a single pattern if it's a string
|
||||||
else if (CONFIG_TYPE_STRING == config_setting_type(setting)) {
|
else if (CONFIG_TYPE_STRING == config_setting_type(setting)) {
|
||||||
condlst_add(pcondlst, config_setting_get_string(setting));
|
condlst_add(pcondlst, config_setting_get_string(setting));
|
||||||
|
@ -145,20 +147,24 @@ parse_cfg_condlst_corner(options_t *opt, const config_t *pcfg, const char *name)
|
||||||
// Parse an array of options
|
// Parse an array of options
|
||||||
if (config_setting_is_array(setting)) {
|
if (config_setting_is_array(setting)) {
|
||||||
int i = config_setting_length(setting);
|
int i = config_setting_length(setting);
|
||||||
while (i--)
|
while (i--) {
|
||||||
if (!parse_numeric_window_rule(
|
if (!parse_numeric_window_rule(
|
||||||
&opt->corner_radius_rules,
|
&opt->corner_radius_rules,
|
||||||
config_setting_get_string_elem(setting, i), 0, INT_MAX))
|
config_setting_get_string_elem(setting, i), 0,
|
||||||
|
INT_MAX)) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Treat it as a single pattern if it's a string
|
// Treat it as a single pattern if it's a string
|
||||||
else if (config_setting_type(setting) == CONFIG_TYPE_STRING) {
|
else if (config_setting_type(setting) == CONFIG_TYPE_STRING) {
|
||||||
if (!parse_numeric_window_rule(&opt->corner_radius_rules,
|
if (!parse_numeric_window_rule(&opt->corner_radius_rules,
|
||||||
config_setting_get_string(setting),
|
config_setting_get_string(setting),
|
||||||
0, INT_MAX))
|
0, INT_MAX)) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,19 +177,23 @@ parse_cfg_condlst_opct(options_t *opt, const config_t *pcfg, const char *name) {
|
||||||
// Parse an array of options
|
// Parse an array of options
|
||||||
if (config_setting_is_array(setting)) {
|
if (config_setting_is_array(setting)) {
|
||||||
int i = config_setting_length(setting);
|
int i = config_setting_length(setting);
|
||||||
while (i--)
|
while (i--) {
|
||||||
if (!parse_numeric_window_rule(
|
if (!parse_numeric_window_rule(
|
||||||
&opt->opacity_rules,
|
&opt->opacity_rules,
|
||||||
config_setting_get_string_elem(setting, i), 0, 100))
|
config_setting_get_string_elem(setting, i), 0, 100)) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Treat it as a single pattern if it's a string
|
// Treat it as a single pattern if it's a string
|
||||||
else if (config_setting_type(setting) == CONFIG_TYPE_STRING) {
|
else if (config_setting_type(setting) == CONFIG_TYPE_STRING) {
|
||||||
if (!parse_numeric_window_rule(
|
if (!parse_numeric_window_rule(&opt->opacity_rules,
|
||||||
&opt->opacity_rules, config_setting_get_string(setting), 0, 100))
|
config_setting_get_string(setting),
|
||||||
|
0, 100)) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -381,8 +391,9 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
|
||||||
winopt_mask[WINTYPE_POPUP_MENU].opacity = true;
|
winopt_mask[WINTYPE_POPUP_MENU].opacity = true;
|
||||||
}
|
}
|
||||||
// -f (fading_enable)
|
// -f (fading_enable)
|
||||||
if (config_lookup_bool(&cfg, "fading", &ival))
|
if (config_lookup_bool(&cfg, "fading", &ival)) {
|
||||||
*fading_enable = ival;
|
*fading_enable = ival;
|
||||||
|
}
|
||||||
// --no-fading-open-close
|
// --no-fading-open-close
|
||||||
lcfg_lookup_bool(&cfg, "no-fading-openclose", &opt->no_fading_openclose);
|
lcfg_lookup_bool(&cfg, "no-fading-openclose", &opt->no_fading_openclose);
|
||||||
// --no-fading-destroyed-argb
|
// --no-fading-destroyed-argb
|
||||||
|
@ -402,8 +413,9 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
|
||||||
opt->shadow_blue = rgb.blue;
|
opt->shadow_blue = rgb.blue;
|
||||||
}
|
}
|
||||||
// --shadow-exclude-reg
|
// --shadow-exclude-reg
|
||||||
if (config_lookup_string(&cfg, "shadow-exclude-reg", &sval))
|
if (config_lookup_string(&cfg, "shadow-exclude-reg", &sval)) {
|
||||||
opt->shadow_exclude_reg_str = strdup(sval);
|
opt->shadow_exclude_reg_str = strdup(sval);
|
||||||
|
}
|
||||||
// --inactive-opacity-override
|
// --inactive-opacity-override
|
||||||
lcfg_lookup_bool(&cfg, "inactive-opacity-override", &opt->inactive_opacity_override);
|
lcfg_lookup_bool(&cfg, "inactive-opacity-override", &opt->inactive_opacity_override);
|
||||||
// --inactive-dim
|
// --inactive-dim
|
||||||
|
@ -601,9 +613,10 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
|
||||||
// --xrender-sync-fence
|
// --xrender-sync-fence
|
||||||
lcfg_lookup_bool(&cfg, "xrender-sync-fence", &opt->xrender_sync_fence);
|
lcfg_lookup_bool(&cfg, "xrender-sync-fence", &opt->xrender_sync_fence);
|
||||||
|
|
||||||
if (lcfg_lookup_bool(&cfg, "clear-shadow", &bval))
|
if (lcfg_lookup_bool(&cfg, "clear-shadow", &bval)) {
|
||||||
log_warn("\"clear-shadow\" is removed as an option, and is always"
|
log_warn("\"clear-shadow\" is removed as an option, and is always"
|
||||||
" enabled now. Consider removing it from your config file");
|
" enabled now. Consider removing it from your config file");
|
||||||
|
}
|
||||||
|
|
||||||
config_setting_t *blur_cfg = config_lookup(&cfg, "blur");
|
config_setting_t *blur_cfg = config_lookup(&cfg, "blur");
|
||||||
if (blur_cfg) {
|
if (blur_cfg) {
|
||||||
|
|
Loading…
Reference in a new issue