Change opacity between 0 and 1 and update validation

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-24 07:47:07 +01:00
parent 8ba54194de
commit afa8591d50
3 changed files with 8 additions and 6 deletions

View File

@ -53,10 +53,10 @@ new_become_master::
new_get_focus::
If this is set to true, new windows will get focus.
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.
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.
resize_hints::
If this is set to true, resize hints given by the window will be respected.

View File

@ -377,7 +377,7 @@ cfg_opt_t rule_opts[] =
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
CFG_SEC((char *) "titlebar", titlebar_opts, 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_opt_t rules_opts[] =
@ -505,7 +505,6 @@ cfg_new(void)
/* Check integers values */
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|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|height", 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_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|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;
}

View File

@ -194,9 +194,9 @@ window_settrans(Window win, double opacity)
int status;
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,
XInternAtom(globalconf.display, "_NET_WM_WINDOW_OPACITY", False),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &real_opacity, 1L);