diff options
Diffstat (limited to '')
| -rw-r--r-- | client.c | 15 |
1 files changed, 5 insertions, 10 deletions
| @@ -10,13 +10,6 @@ | |||
| 10 | /* static */ | 10 | /* static */ |
| 11 | 11 | ||
| 12 | static void | 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 | detachstack(Client *c) { | 13 | detachstack(Client *c) { |
| 21 | Client **tc; | 14 | Client **tc; |
| 22 | for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); | 15 | for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); |
| @@ -191,7 +184,7 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 191 | 184 | ||
| 192 | void | 185 | void |
| 193 | resize(Client *c, Bool sizehints) { | 186 | resize(Client *c, Bool sizehints) { |
| 194 | float dx, dy, min, max, actual; | 187 | float actual, dx, dy, max, min, u; |
| 195 | XWindowChanges wc; | 188 | XWindowChanges wc; |
| 196 | 189 | ||
| 197 | if(c->w <= 0 || c->h <= 0) | 190 | if(c->w <= 0 || c->h <= 0) |
| @@ -214,12 +207,14 @@ resize(Client *c, Bool sizehints) { | |||
| 214 | actual = dx / dy; | 207 | actual = dx / dy; |
| 215 | if(max > 0 && min > 0 && actual > 0) { | 208 | if(max > 0 && min > 0 && actual > 0) { |
| 216 | if(actual < min) { | 209 | if(actual < min) { |
| 217 | closestpt(&dx, &dy, dx, dy, min); | 210 | dy = (dx * min + dy) / (min * min + 1); |
| 211 | dx = dy * min; | ||
| 218 | c->w = (int)dx + c->basew; | 212 | c->w = (int)dx + c->basew; |
| 219 | c->h = (int)dy + c->baseh; | 213 | c->h = (int)dy + c->baseh; |
| 220 | } | 214 | } |
| 221 | else if(actual > max) { | 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 | c->w = (int)dx + c->basew; | 218 | c->w = (int)dx + c->basew; |
| 224 | c->h = (int)dy + c->baseh; | 219 | c->h = (int)dy + c->baseh; |
| 225 | } | 220 | } |
