about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--dwm.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/dwm.c b/dwm.c
index ba24d9a..ae2952b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1046,23 +1046,34 @@ quit(const Arg *arg) {
 
 void
 resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
+	float a;
 	XWindowChanges wc;
 
 	if(sizehints) {
+		/* see last two sentences in ICCCM 4.1.2.3 */
+		Bool baseismin = c->basew == c->minw && c->baseh == c->minh;
+
 		/* set minimum possible */
 		w = MAX(1, w);
 		h = MAX(1, h);
 
-		/* temporarily remove base dimensions */
-		w -= c->basew;
-		h -= c->baseh;
+		if(!baseismin) { /* temporarily remove base dimensions */
+			w -= c->basew;
+			h -= c->baseh;
+		}
 
 		/* adjust for aspect limits */
 		if(c->mina > 0 && c->maxa > 0) {
-			if(c->maxa < (float) w/h)
+			a = (float) w/h;
+			if(a > c->maxa)
 				w = h * c->maxa;
-			else if(c->mina > (float) h/w)
-				h = w * c->mina;
+			else if(a < c->mina)
+				h = w / c->mina;
+		}
+
+		if(baseismin) { /* increment calculation requires this */
+			w -= c->basew;
+			h -= c->baseh;
 		}
 
 		/* adjust for increment value */
ed by Sander for dwm target' href='/acidbong/suckless/dwm/commit/README?h=5.7&id=5d3fd3707b262508d1750cf95ac2e2f666be6163'>5d3fd37 ^
1076f2b




650a1fb ^
01a8d44 ^
650a1fb ^
1076f2b
650a1fb ^
1076f2b
650a1fb ^
1076f2b

650a1fb ^
1076f2b
eff4478 ^
1076f2b
7b5638f ^

98c6a92 ^
98c6a92 ^

02cea3b ^
7b5638f ^
2b66f7a ^
98c6a92 ^
7b5638f ^
1076f2b

dc5c070 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48