aboutsummaryrefslogtreecommitdiff
path: root/src/config_libconfig.c
diff options
context:
space:
mode:
authorallusive-dev <[email protected]>2023-10-13 15:37:56 +1100
committerallusive-dev <[email protected]>2023-10-13 15:37:56 +1100
commitc157fa368e01f6f2cf2c1257d55da01cfd605ccf (patch)
tree7c0ded9d1e2312fe915326d7445317ad988e292e /src/config_libconfig.c
parentUpdate README.md (diff)
downloadcompfy-c157fa368e01f6f2cf2c1257d55da01cfd605ccf.tar.xz
compfy-c157fa368e01f6f2cf2c1257d55da01cfd605ccf.zip
testing corner-rules
Diffstat (limited to 'src/config_libconfig.c')
-rw-r--r--src/config_libconfig.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/config_libconfig.c b/src/config_libconfig.c
index 4bb4cbf..2494e0e 100644
--- a/src/config_libconfig.c
+++ b/src/config_libconfig.c
@@ -250,6 +250,31 @@ parse_cfg_condlst_opct(options_t *opt, const config_t *pcfg, const char *name) {
}
}
+/**
+ * Parse a corner rule list in configuration file.
+ */
+static inline void
+parse_cfg_condlst_corner(options_t *opt, const config_t *pcfg, const char *name) {
+ config_setting_t *setting = config_lookup(pcfg, name);
+ if (setting) {
+ // Parse an array of options
+ if (config_setting_is_array(setting)) {
+ int i = config_setting_length(setting);
+ while (i--)
+ if (!parse_rule_corners(
+ &opt->corner_rules,
+ config_setting_get_string_elem(setting, i)))
+ exit(1);
+ }
+ // Treat it as a single pattern if it's a string
+ else if (config_setting_type(setting) == CONFIG_TYPE_STRING) {
+ if (!parse_rule_corners(&opt->corner_rules,
+ config_setting_get_string(setting)))
+ exit(1);
+ }
+ }
+}
+
static inline void parse_wintype_config(const config_t *cfg, const char *member_name,
win_option_t *o, win_option_mask_t *mask) {
char *str = mstrjoin("wintypes.", member_name);
@@ -620,6 +645,8 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
parse_cfg_condlst(&cfg, &opt->animation_open_blacklist, "animation-open-exclude");
// animation exclude
parse_cfg_condlst(&cfg, &opt->animation_unmap_blacklist, "animation-unmap-exclude");
+ // --corners-rule
+ parse_cfg_condlst_corner(opt, &cfg, "corners-rule");
// --invert-color-include
parse_cfg_condlst(&cfg, &opt->invert_color_list, "invert-color-include");
// --blur-background-exclude