Add mwfact_lower_limit and mwfact_upper_limit to configure limits of mwfact value

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-08 10:48:15 +01:00
parent 6161fc2130
commit 8a685bf177
5 changed files with 36 additions and 4 deletions

View File

@ -564,6 +564,8 @@ screen <integer> [MULTI]
sloppy_focus_raise = <boolean> sloppy_focus_raise = <boolean>
snap = <integer> snap = <integer>
floating_placement = <{smart,under_mouse}> floating_placement = <{smart,under_mouse}>
mwfact_lower_limit = <float>
mwfact_upper_limit = <float>
} }
tags tags
{ {

View File

@ -80,6 +80,8 @@ cfg_opt_t general_opts[] =
CFG_INT((char *) "text_shadow_offset", 1, CFGF_NONE), CFG_INT((char *) "text_shadow_offset", 1, CFGF_NONE),
CFG_INT((char *) "opacity_unfocused", -1, CFGF_NONE), CFG_INT((char *) "opacity_unfocused", -1, CFGF_NONE),
CFG_STR((char *) "floating_placement", (char *) "smart", CFGF_NONE), CFG_STR((char *) "floating_placement", (char *) "smart", CFGF_NONE),
CFG_FLOAT((char *) "mwfact_lower_limit", 0.1, CFGF_NONE),
CFG_FLOAT((char *) "mwfact_upper_limit", 0.9, CFGF_NONE),
CFG_AWESOME_END() CFG_AWESOME_END()
}; };
cfg_opt_t colors_opts[] = cfg_opt_t colors_opts[] =

View File

@ -323,6 +323,30 @@ config_parse_screen(cfg_t *cfg, int screen)
name_func_lookup(cfg_getstr(cfg_general, "floating_placement"), name_func_lookup(cfg_getstr(cfg_general, "floating_placement"),
FloatingPlacementList); FloatingPlacementList);
virtscreen->mwfact_lower_limit = cfg_getfloat(cfg_general, "mwfact_lower_limit");
virtscreen->mwfact_upper_limit = cfg_getfloat(cfg_general, "mwfact_upper_limit");
if(virtscreen->mwfact_lower_limit < 0 || virtscreen->mwfact_lower_limit > 1)
{
warn("incorrect value %f for mwfact_lower_limit, must be between 0 and 1\n",
virtscreen->mwfact_lower_limit);
virtscreen->mwfact_lower_limit = 0.1;
}
if(virtscreen->mwfact_upper_limit < 0 || virtscreen->mwfact_upper_limit > 1)
{
warn("incorrect value %f for mwfact_upper_limit, must be between 0 and 1\n",
virtscreen->mwfact_lower_limit);
virtscreen->mwfact_upper_limit = 0.9;
}
if(virtscreen->mwfact_upper_limit < virtscreen->mwfact_lower_limit)
{
warn("mwfact_upper_limit must be greater than mwfact_lower_limit\n");
virtscreen->mwfact_upper_limit = 0.9;
virtscreen->mwfact_lower_limit = 0.1;
}
if(!virtscreen->floating_placement) if(!virtscreen->floating_placement)
{ {
warn("unknown floating placement: %s\n", cfg_getstr(cfg_general, "floating_placement")); warn("unknown floating placement: %s\n", cfg_getstr(cfg_general, "floating_placement"));

View File

@ -112,10 +112,12 @@ uicb_tag_setmwfact(int screen, char *arg)
newarg[0] = '+'; newarg[0] = '+';
} }
if((curtags[0]->mwfact = compute_new_value_from_arg(newarg, curtags[0]->mwfact)) < 0.1) curtags[0]->mwfact = compute_new_value_from_arg(newarg, curtags[0]->mwfact);
curtags[0]->mwfact = 0.1;
else if(curtags[0]->mwfact > 0.9) if(curtags[0]->mwfact < globalconf.screens[screen].mwfact_lower_limit)
curtags[0]->mwfact = 0.9; curtags[0]->mwfact = globalconf.screens[screen].mwfact_lower_limit;
else if(curtags[0]->mwfact > globalconf.screens[screen].mwfact_upper_limit)
curtags[0]->mwfact = globalconf.screens[screen].mwfact_upper_limit;
p_delete(&newarg); p_delete(&newarg);
p_delete(&curtags); p_delete(&curtags);

View File

@ -253,6 +253,8 @@ typedef struct
int snap; int snap;
/** Border size */ /** Border size */
int borderpx; int borderpx;
/** Mwfact limits */
float mwfact_upper_limit, mwfact_lower_limit;
/** Floating window placement algo */ /** Floating window placement algo */
FloatingPlacement *floating_placement; FloatingPlacement *floating_placement;
/** Respect resize hints */ /** Respect resize hints */