about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--client.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/client.c b/client.c
index 2b194d7..6d88222 100644
--- a/client.c
+++ b/client.c
@@ -10,13 +10,6 @@
 /* static */
 
 static void
-closestpt(float *rx, float *ry, float x, float y, float grad) {
-	float u = (x * grad + y) / (grad * grad + 1);
-	*rx = u * grad;
-	*ry = u;
-}
-
-static void
 detachstack(Client *c) {
 	Client **tc;
 	for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
@@ -191,7 +184,7 @@ manage(Window w, XWindowAttributes *wa) {
 
 void
 resize(Client *c, Bool sizehints) {
-	float dx, dy, min, max, actual;
+	float actual, dx, dy, max, min, u;
 	XWindowChanges wc;
 
 	if(c->w <= 0 || c->h <= 0)
@@ -214,12 +207,14 @@ resize(Client *c, Bool sizehints) {
 			actual = dx / dy;
 			if(max > 0 && min > 0 && actual > 0) {
 				if(actual < min) {
-					closestpt(&dx, &dy, dx, dy, min);
+					dy = (dx * min + dy) / (min * min + 1);
+					dx = dy * min;
 					c->w = (int)dx + c->basew;
 					c->h = (int)dy + c->baseh;
 				}
 				else if(actual > max) {
-					closestpt(&dx, &dy, dx, dy, max);
+					dy = (dx * min + dy) / (max * max + 1);
+					dx = dy * min;
 					c->w = (int)dx + c->basew;
 					c->h = (int)dy + c->baseh;
 				}
.7&id=605630c14522759a0a7521d3d74ee2340591147f'>605630c ^
b2e98bf ^





eb184e0 ^



b2e98bf ^
605630c ^
650a1fb ^
eb184e0 ^
650a1fb ^

3791ec0 ^
eb184e0 ^



3791ec0 ^





eb184e0 ^



3791ec0 ^

eb184e0 ^



3791ec0 ^

eb184e0 ^











3791ec0 ^


eb184e0 ^

3791ec0 ^

eb184e0 ^


6458d72 ^

605630c ^
6649dcc ^
3791ec0 ^
650a1fb ^
605630c ^
1e7e57d ^
6649dcc ^



1e7e57d ^

3657eae ^
650a1fb ^
6649dcc ^
650a1fb ^

6649dcc ^
650a1fb ^
3657eae ^
7faa8a9 ^
deba506 ^
7faa8a9 ^
3657eae ^
6458d72 ^

f60c597 ^
6458d72 ^
d34b4c7 ^
650a1fb ^

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118