aboutsummaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2020-04-20 16:41:52 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2020-04-20 17:56:41 +0200
commita8e9513783f335b1ac7255e40a663adfffc4b475 (patch)
treeb5782bc2b06e1909f9baffdca55a0a784f00e73d /dwm.c
parentc82db690cc0c4624dad4dc6ae899020799ec84db (diff)
downloaddwm-a8e9513783f335b1ac7255e40a663adfffc4b475.tar.gz
dwm-a8e9513783f335b1ac7255e40a663adfffc4b475.tar.bz2
dwm-a8e9513783f335b1ac7255e40a663adfffc4b475.zip
setmfact: Unify bounds for compile-time and runtime mfact
There are two places that mfact can be set: - In the mfact global, which is defined at compile time and passed into m->mfact during monitor setup. No bounds checks are performed, but the comment alongside it says that valid values are [0.05..0.95]: static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ - By setmfact, which adjusts m->mfact at runtime. It also does some minimum and maximum bounds checks, allowing [0.1..0.9]. Values outside of that range are ignored, and mfact is not adjusted. These different thresholds mean that one cannot setmfact 0.95 or 0.05, despite the comment above that lists the legal range for mfact. Clarify this by enforcing the same bounds in setmfact at runtime as those listed for mfact at compile time.
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dwm.c b/dwm.c
index 4465af1..41c6767 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1520,7 +1520,7 @@ setmfact(const Arg *arg)
if (!arg || !selmon->lt[selmon->sellt]->arrange)
return;
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
- if (f < 0.1 || f > 0.9)
+ if (f < 0.05 || f > 0.95)
return;
selmon->mfact = f;
arrange(selmon);