[hackers] [dwm] made resize more precise

From: Anselm R. Garbe <garbeam_AT_gmail.com>
Date: Mon Aug 13 18:24:41 2007

changeset: 945:89ea2acd2646
tag: tip
user: Anselm R. Garbe <garbeam_AT_gmail.com>
date: Mon Aug 13 18:24:15 2007 +0200
summary: made resize more precise

diff -r bd5cf635c601 -r 89ea2acd2646 client.c
--- a/client.c Sun Aug 12 13:10:21 2007 +0200
+++ b/client.c Mon Aug 13 18:24:15 2007 +0200
@@ -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, i
                         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;
Received on Mon Aug 13 2007 - 18:24:41 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:51 UTC