summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-06 15:28:25 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-06 15:28:25 +0100
commitdafbd0dcb00366e9ef36079e30d8338b199b8034 (patch)
tree2478d1db1bb0cd6564166bbab389c6eec49e3a31
parentimplemented aspect ratio support of windows (diff)
downloaddwm-dafbd0dcb00366e9ef36079e30d8338b199b8034.tar.gz
dwm-dafbd0dcb00366e9ef36079e30d8338b199b8034.zip
simplification
Diffstat (limited to '')
-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 @@
10/* static */ 10/* static */
11 11
12static void 12static void
13closestpt(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
19static void
20detachstack(Client *c) { 13detachstack(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
192void 185void
193resize(Client *c, Bool sizehints) { 186resize(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 }