simplification
dafbd0dc
1 file(s) · +5 −10
| 10 | 10 | /* static */ |
|
| 11 | 11 | ||
| 12 | 12 | static void |
|
| 13 | - | closestpt(float *rx, float *ry, float x, float y, float grad) { |
|
| 14 | - | float u = (x * grad + y) / (grad * grad + 1); |
|
| 15 | - | *rx = u * grad; |
|
| 16 | - | *ry = u; |
|
| 17 | - | } |
|
| 18 | - | ||
| 19 | - | static void |
|
| 20 | 13 | detachstack(Client *c) { |
|
| 21 | 14 | Client **tc; |
|
| 22 | 15 | for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); |
|
| 191 | 184 | ||
| 192 | 185 | void |
|
| 193 | 186 | resize(Client *c, Bool sizehints) { |
|
| 194 | - | float dx, dy, min, max, actual; |
|
| 187 | + | float actual, dx, dy, max, min, u; |
|
| 195 | 188 | XWindowChanges wc; |
|
| 196 | 189 | ||
| 197 | 190 | if(c->w <= 0 || c->h <= 0) |
|
| 214 | 207 | actual = dx / dy; |
|
| 215 | 208 | if(max > 0 && min > 0 && actual > 0) { |
|
| 216 | 209 | if(actual < min) { |
|
| 217 | - | closestpt(&dx, &dy, dx, dy, min); |
|
| 210 | + | dy = (dx * min + dy) / (min * min + 1); |
|
| 211 | + | dx = dy * min; |
|
| 218 | 212 | c->w = (int)dx + c->basew; |
|
| 219 | 213 | c->h = (int)dy + c->baseh; |
|
| 220 | 214 | } |
|
| 221 | 215 | else if(actual > max) { |
|
| 222 | - | closestpt(&dx, &dy, dx, dy, max); |
|
| 216 | + | dy = (dx * min + dy) / (max * max + 1); |
|
| 217 | + | dx = dy * min; |
|
| 223 | 218 | c->w = (int)dx + c->basew; |
|
| 224 | 219 | c->h = (int)dy + c->baseh; |
|
| 225 | 220 | } |
|