@@ -2469,7 +2469,7 @@ static void
24692469win_update_opacity_rule (session_t * ps , win * w ) {
24702470 // If long is 32-bit, unfortunately there's no way could we express "unset",
24712471 // so we just entirely don't distinguish "unset" and OPAQUE
2472- long opacity = OPAQUE ;
2472+ opacity_t opacity = OPAQUE ;
24732473 void * val = NULL ;
24742474 if (c2_matchd (ps , w , ps -> o .opacity_rules , & w -> cache_oparule , & val ))
24752475 opacity = ((double ) (long ) val ) / 100.0 * OPAQUE ;
@@ -5029,9 +5029,8 @@ parse_cfg_condlst(session_t *ps, const config_t *pcfg, c2_lptr_t **pcondlst,
50295029 // Parse an array of options
50305030 if (config_setting_is_array (setting )) {
50315031 int i = config_setting_length (setting );
5032- while (i -- ) {
5032+ while (i -- )
50335033 condlst_add (ps , pcondlst , config_setting_get_string_elem (setting , i ));
5034- }
50355034 }
50365035 // Treat it as a single pattern if it's a string
50375036 else if (CONFIG_TYPE_STRING == config_setting_type (setting )) {
@@ -5040,6 +5039,26 @@ parse_cfg_condlst(session_t *ps, const config_t *pcfg, c2_lptr_t **pcondlst,
50405039 }
50415040}
50425041
5042+ /**
5043+ * Parse an opacity rule list in configuration file.
5044+ */
5045+ static inline void
5046+ parse_cfg_condlst_opct (session_t * ps , const config_t * pcfg , const char * name ) {
5047+ config_setting_t * setting = config_lookup (pcfg , name );
5048+ if (setting ) {
5049+ // Parse an array of options
5050+ if (config_setting_is_array (setting )) {
5051+ int i = config_setting_length (setting );
5052+ while (i -- )
5053+ parse_rule_opacity (ps , config_setting_get_string_elem (setting , i ));
5054+ }
5055+ // Treat it as a single pattern if it's a string
5056+ else if (CONFIG_TYPE_STRING == config_setting_type (setting )) {
5057+ parse_rule_opacity (ps , config_setting_get_string (setting ));
5058+ }
5059+ }
5060+ }
5061+
50435062/**
50445063 * Parse a configuration file from default location.
50455064 */
@@ -5213,7 +5232,7 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) {
52135232 // --blur-background-exclude
52145233 parse_cfg_condlst (ps , & cfg , & ps -> o .blur_background_blacklist , "blur-background-exclude" );
52155234 // --opacity-rule
5216- parse_cfg_condlst (ps , & cfg , & ps -> o . opacity_rules , "opacity-rule" );
5235+ parse_cfg_condlst_opct (ps , & cfg , "opacity-rule" );
52175236 // --unredir-if-possible-exclude
52185237 parse_cfg_condlst (ps , & cfg , & ps -> o .unredir_if_possible_blacklist , "unredir-if-possible-exclude" );
52195238 // --blur-background
0 commit comments