Bug fix #149: --opacity-rule misbehaves on 32-bit systems & others
- Fix a bug that --opacity-rule misbehaves with a value higher than 50% on 32-bit systems. Thanks to mrinx for reporting. (#149) - Fix a bug that opacity-rule in configuration file does not work.
This commit is contained in:
parent
fc8ec8851f
commit
796e2c6fec
|
@ -31,7 +31,7 @@ blur-kern = "3x3box"
|
||||||
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
|
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
|
||||||
# blur-background-fixed = true;
|
# blur-background-fixed = true;
|
||||||
blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ];
|
blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ];
|
||||||
opacity-rule = [ ]
|
# opacity-rule = [ "80:class_g = 'URxvt'" ];
|
||||||
|
|
||||||
# Fading
|
# Fading
|
||||||
fading = true;
|
fading = true;
|
||||||
|
|
|
@ -2469,7 +2469,7 @@ static void
|
||||||
win_update_opacity_rule(session_t *ps, win *w) {
|
win_update_opacity_rule(session_t *ps, win *w) {
|
||||||
// If long is 32-bit, unfortunately there's no way could we express "unset",
|
// If long is 32-bit, unfortunately there's no way could we express "unset",
|
||||||
// so we just entirely don't distinguish "unset" and OPAQUE
|
// so we just entirely don't distinguish "unset" and OPAQUE
|
||||||
long opacity = OPAQUE;
|
opacity_t opacity = OPAQUE;
|
||||||
void *val = NULL;
|
void *val = NULL;
|
||||||
if (c2_matchd(ps, w, ps->o.opacity_rules, &w->cache_oparule, &val))
|
if (c2_matchd(ps, w, ps->o.opacity_rules, &w->cache_oparule, &val))
|
||||||
opacity = ((double) (long) val) / 100.0 * OPAQUE;
|
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,
|
||||||
// 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(ps, pcondlst, config_setting_get_string_elem(setting, i));
|
condlst_add(ps, pcondlst, 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)) {
|
||||||
|
@ -5040,6 +5039,26 @@ parse_cfg_condlst(session_t *ps, const config_t *pcfg, c2_lptr_t **pcondlst,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse an opacity rule list in configuration file.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
parse_cfg_condlst_opct(session_t *ps, 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--)
|
||||||
|
parse_rule_opacity(ps, config_setting_get_string_elem(setting, i));
|
||||||
|
}
|
||||||
|
// Treat it as a single pattern if it's a string
|
||||||
|
else if (CONFIG_TYPE_STRING == config_setting_type(setting)) {
|
||||||
|
parse_rule_opacity(ps, config_setting_get_string(setting));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a configuration file from default location.
|
* Parse a configuration file from default location.
|
||||||
*/
|
*/
|
||||||
|
@ -5213,7 +5232,7 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) {
|
||||||
// --blur-background-exclude
|
// --blur-background-exclude
|
||||||
parse_cfg_condlst(ps, &cfg, &ps->o.blur_background_blacklist, "blur-background-exclude");
|
parse_cfg_condlst(ps, &cfg, &ps->o.blur_background_blacklist, "blur-background-exclude");
|
||||||
// --opacity-rule
|
// --opacity-rule
|
||||||
parse_cfg_condlst(ps, &cfg, &ps->o.opacity_rules, "opacity-rule");
|
parse_cfg_condlst_opct(ps, &cfg, "opacity-rule");
|
||||||
// --unredir-if-possible-exclude
|
// --unredir-if-possible-exclude
|
||||||
parse_cfg_condlst(ps, &cfg, &ps->o.unredir_if_possible_blacklist, "unredir-if-possible-exclude");
|
parse_cfg_condlst(ps, &cfg, &ps->o.unredir_if_possible_blacklist, "unredir-if-possible-exclude");
|
||||||
// --blur-background
|
// --blur-background
|
||||||
|
|
|
@ -476,9 +476,10 @@ win_has_frame(const win *w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
wid_set_opacity_prop(session_t *ps, Window wid, long val) {
|
wid_set_opacity_prop(session_t *ps, Window wid, opacity_t val) {
|
||||||
|
const unsigned long v = val;
|
||||||
XChangeProperty(ps->dpy, wid, ps->atom_opacity, XA_CARDINAL, 32,
|
XChangeProperty(ps->dpy, wid, ps->atom_opacity, XA_CARDINAL, 32,
|
||||||
PropModeReplace, (unsigned char *) &val, 1);
|
PropModeReplace, (unsigned char *) &v, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
Loading…
Reference in New Issue