summaryrefslogtreecommitdiffhomepage
path: root/patch/floatpos.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-06-23 11:55:55 +0200
committerbakkeby <[email protected]>2020-06-23 11:55:55 +0200
commit9ae251791df7a5c70aea829b1671c0f64e42b1ef (patch)
treefab35f6565b05bfdbd47b3c8bbfc10d01abd3995 /patch/floatpos.c
parent6c2d1518ab9dfe98124af358dfa67202810782eb (diff)
downloaddwm-flexipatch-9ae251791df7a5c70aea829b1671c0f64e42b1ef.tar.gz
dwm-flexipatch-9ae251791df7a5c70aea829b1671c0f64e42b1ef.zip
floatpos: correction
Diffstat (limited to 'patch/floatpos.c')
-rw-r--r--patch/floatpos.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/patch/floatpos.c b/patch/floatpos.c
index 0f9c57a..33f5bb6 100644
--- a/patch/floatpos.c
+++ b/patch/floatpos.c
@@ -100,10 +100,7 @@ getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp,
case 'Z': // fixed client right-hand position (position + size)
if (pos == -1)
break;
- if (pos > max_s)
- pos = max_s;
- if (pos < 0)
- pos = 0;
+ pos = MAX(MIN(pos, max_s), 0);
if (pCh == 'Z')
cs = abs((cp + cs) - (min_p + pos));
else if (pCh == 'C')
@@ -125,7 +122,7 @@ getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp,
break;
cp = min_p + delta * (size - 1);
} else {
- for (i = 0; i < pos -1 && cp >= min_p + delta * i + (i > pos - rest ? i + rest - pos + 1 : 0); i++);
+ for (i = 0; i < pos && cp >= min_p + delta * i + (i > pos - rest ? i + rest - pos + 1 : 0); i++);
cp = min_p + delta * (MAX(MIN(i + size, pos), 1) - 1) + (i > pos - rest ? i + rest - pos + 1 : 0);
}
break;