use compute_new_value_from_arg in uicb_setmwfact

This commit is contained in:
Julien Danjou 2007-09-14 13:54:59 +02:00
parent 4488708feb
commit 4d03dd3e53
1 changed files with 6 additions and 11 deletions

View File

@ -48,10 +48,11 @@ uicb_setnmaster(Display *disp,
if(!arg) if(!arg)
nmaster = awesomeconf->nmaster; nmaster = awesomeconf->nmaster;
else else
{
nmaster = (int) compute_new_value_from_arg(arg, (double) nmaster); nmaster = (int) compute_new_value_from_arg(arg, (double) nmaster);
if(nmaster < 1) if(nmaster < 1)
nmaster = 1; nmaster = 1;
}
if(sel) if(sel)
arrange(disp, drawcontext, awesomeconf); arrange(disp, drawcontext, awesomeconf);
@ -65,20 +66,14 @@ uicb_setmwfact(Display *disp,
awesome_config * awesomeconf, awesome_config * awesomeconf,
const char *arg) const char *arg)
{ {
double delta;
if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait)) if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait))
return; return;
/* arg handling, manipulate mwfact */
if(!arg) if(!arg)
mwfact = awesomeconf->mwfact; mwfact = awesomeconf->mwfact;
else if(sscanf(arg, "%lf", &delta))
{
if(arg[0] != '+' && arg[0] != '-')
mwfact = delta;
else else
mwfact += delta; {
mwfact = compute_new_value_from_arg(arg, mwfact);
if(mwfact < 0.1) if(mwfact < 0.1)
mwfact = 0.1; mwfact = 0.1;
else if(mwfact > 0.9) else if(mwfact > 0.9)