summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@gmail.com>2007-08-13 18:24:15 +0200
committerAnselm R. Garbe <garbeam@gmail.com>2007-08-13 18:24:15 +0200
commit2feb3afe784cbd9d900bd70aad91431a4b25f2ab (patch)
treeea0e9a151f92f26dac89127a99b04c150fd160b5
parent0937cc78bf5d8855dcd757b18e10c7dd49e7a1ab (diff)
made resize more precise
-rw-r--r--client.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/client.c b/client.c
index d4dfe6e..915a890 100644
--- a/client.c
+++ b/client.c
@@ -235,17 +235,14 @@ manage(Window w, XWindowAttributes *wa) {
void
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
- float dx, dy, max, min, ratio;
- XWindowChanges wc;
-
- if(w <= 0 || h <= 0)
- return;
+ double dx, dy, max, min, ratio;
+ XWindowChanges wc;
if(sizehints) {
- if(c->minay > 0 && c->maxay > 0 && (h - c->baseh) > 0) {
- dx = (float)(w - c->basew);
- dy = (float)(h - c->baseh);
- min = (float)(c->minax) / (float)(c->minay);
- max = (float)(c->maxax) / (float)(c->maxay);
+ if(c->minay > 0 && c->maxay > 0 && (h - c->baseh) > 0 && (w - c->basew) > 0) {
+ dx = (double)(w - c->basew);
+ dy = (double)(h - c->baseh);
+ min = (double)(c->minax) / (double)(c->minay);
+ max = (double)(c->maxax) / (double)(c->maxay);
ratio = dx / dy;
if(max > 0 && min > 0 && ratio > 0) {
if(ratio < min) {
@@ -274,9 +271,9 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
w -= (w - c->basew) % c->incw;
if(c->inch)
h -= (h - c->baseh) % c->inch;
+ if(w <= 0 || h <= 0)
+ return;
}
- if(w <= 0 || h <= 0)
- return;
/* offscreen appearance fixes */
if(x > sw)
x = sw - w - 2 * c->border;