Change opacity between 0 and 1 and update validation
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
8ba54194de
commit
afa8591d50
|
@ -53,10 +53,10 @@ new_become_master::
|
||||||
new_get_focus::
|
new_get_focus::
|
||||||
If this is set to true, new windows will get focus.
|
If this is set to true, new windows will get focus.
|
||||||
opacity_unfocused::
|
opacity_unfocused::
|
||||||
If this is set to a float value between 0 and 100, non-focused windows will have this opacity.
|
If this is set to a float value between 0 and 1, non-focused windows will have this opacity.
|
||||||
This requires an external XComposite manager.
|
This requires an external XComposite manager.
|
||||||
opacity_focused::
|
opacity_focused::
|
||||||
If this is set to a float value between 0 and 100, focused windows will have this opacity.
|
If this is set to a float value between 0 and 1, focused windows will have this opacity.
|
||||||
This requires an external XComposite manager.
|
This requires an external XComposite manager.
|
||||||
resize_hints::
|
resize_hints::
|
||||||
If this is set to true, resize hints given by the window will be respected.
|
If this is set to true, resize hints given by the window will be respected.
|
||||||
|
|
|
@ -377,7 +377,7 @@ cfg_opt_t rule_opts[] =
|
||||||
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
|
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
|
||||||
CFG_SEC((char *) "titlebar", titlebar_opts, CFGF_NONE),
|
CFG_SEC((char *) "titlebar", titlebar_opts, CFGF_NONE),
|
||||||
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
|
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
|
||||||
CFG_FLOAT((char *) "opacity", -1.0f, CFGF_NONE),
|
CFG_FLOAT((char *) "opacity", -1, CFGF_NONE),
|
||||||
CFG_AWESOME_END()
|
CFG_AWESOME_END()
|
||||||
};
|
};
|
||||||
cfg_opt_t rules_opts[] =
|
cfg_opt_t rules_opts[] =
|
||||||
|
@ -505,7 +505,6 @@ cfg_new(void)
|
||||||
/* Check integers values */
|
/* Check integers values */
|
||||||
cfg_set_validate_func(cfg, "screen|general|snap", config_validate_unsigned_int);
|
cfg_set_validate_func(cfg, "screen|general|snap", config_validate_unsigned_int);
|
||||||
cfg_set_validate_func(cfg, "screen|general|border", config_validate_unsigned_int);
|
cfg_set_validate_func(cfg, "screen|general|border", config_validate_unsigned_int);
|
||||||
cfg_set_validate_func(cfg, "screen|general|opacity_unfocused", config_validate_unsigned_int);
|
|
||||||
cfg_set_validate_func(cfg, "screen|statusbar|width", config_validate_unsigned_int);
|
cfg_set_validate_func(cfg, "screen|statusbar|width", config_validate_unsigned_int);
|
||||||
cfg_set_validate_func(cfg, "screen|statusbar|height", config_validate_unsigned_int);
|
cfg_set_validate_func(cfg, "screen|statusbar|height", config_validate_unsigned_int);
|
||||||
cfg_set_validate_func(cfg, "screen|statusbar|textbox|width", config_validate_unsigned_int);
|
cfg_set_validate_func(cfg, "screen|statusbar|textbox|width", config_validate_unsigned_int);
|
||||||
|
@ -518,6 +517,9 @@ cfg_new(void)
|
||||||
cfg_set_validate_func(cfg, "screen|general|mwfact_lower_limit", config_validate_zero_one_float);
|
cfg_set_validate_func(cfg, "screen|general|mwfact_lower_limit", config_validate_zero_one_float);
|
||||||
cfg_set_validate_func(cfg, "screen|general|mwfact_upper_limit", config_validate_zero_one_float);
|
cfg_set_validate_func(cfg, "screen|general|mwfact_upper_limit", config_validate_zero_one_float);
|
||||||
cfg_set_validate_func(cfg, "screen|tags|tag|mwfact", config_validate_zero_one_float);
|
cfg_set_validate_func(cfg, "screen|tags|tag|mwfact", config_validate_zero_one_float);
|
||||||
|
cfg_set_validate_func(cfg, "screen|general|opacity_unfocused", config_validate_zero_one_float);
|
||||||
|
cfg_set_validate_func(cfg, "screen|general|opacity_focused", config_validate_zero_one_float);
|
||||||
|
cfg_set_validate_func(cfg, "rules|rule|opacity", config_validate_zero_one_float);
|
||||||
|
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
4
window.c
4
window.c
|
@ -194,9 +194,9 @@ window_settrans(Window win, double opacity)
|
||||||
int status;
|
int status;
|
||||||
unsigned int real_opacity = 0xffffffff;
|
unsigned int real_opacity = 0xffffffff;
|
||||||
|
|
||||||
if(opacity >= 0 && opacity <= 100)
|
if(opacity >= 0 && opacity <= 1)
|
||||||
{
|
{
|
||||||
real_opacity = ((opacity / 100.0) * 0xffffffff);
|
real_opacity = opacity * 0xffffffff;
|
||||||
status = XChangeProperty(globalconf.display, win,
|
status = XChangeProperty(globalconf.display, win,
|
||||||
XInternAtom(globalconf.display, "_NET_WM_WINDOW_OPACITY", False),
|
XInternAtom(globalconf.display, "_NET_WM_WINDOW_OPACITY", False),
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &real_opacity, 1L);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &real_opacity, 1L);
|
||||||
|
|
Loading…
Reference in New Issue