From 71f8651be40544b3509ecefb35bd644e3ec791af Mon Sep 17 00:00:00 2001 From: oga Date: Tue, 25 Aug 2009 01:32:40 +0000 Subject: Instead of messing around everytime we do a resize, just clamp the resize increments to a minimum of one, and use it unconditionally. "you've convinced me, do it!" okan@ --- client.c | 11 ++++++----- mousefunc.c | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client.c b/client.c index 70287ae..b9aaf66 100644 --- a/client.c +++ b/client.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: client.c,v 1.62 2009/08/25 01:26:09 okan Exp $ + * $Id: client.c,v 1.63 2009/08/25 01:32:40 oga Exp $ */ #include "headers.h" @@ -685,6 +685,9 @@ client_getsizehints(struct client_ctx *cc) cc->geom.incw = cc->size->width_inc; cc->geom.inch = cc->size->height_inc; } + cc->geom.incw = MAX(1, cc->geom.incw); + cc->geom.inch = MAX(1, cc->geom.inch); + if (cc->size->flags & PAspect) { if (cc->size->min_aspect.x > 0) cc->geom.mina = (float)cc->size->min_aspect.y / @@ -725,10 +728,8 @@ client_applysizehints(struct client_ctx *cc) } /* adjust for increment value */ - if (cc->geom.incw) - cc->geom.width -= cc->geom.width % cc->geom.incw; - if (cc->geom.inch) - cc->geom.height -= cc->geom.height % cc->geom.inch; + cc->geom.width -= cc->geom.width % cc->geom.incw; + cc->geom.height -= cc->geom.height % cc->geom.inch; /* restore base dimensions */ cc->geom.width += cc->geom.basew; diff --git a/mousefunc.c b/mousefunc.c index 5b43a81..c40fb6a 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: mousefunc.c,v 1.13 2009/08/24 23:49:04 okan Exp $ + * $Id: mousefunc.c,v 1.14 2009/08/25 01:32:40 oga Exp $ */ #include "headers.h" @@ -49,8 +49,8 @@ mousefunc_sweep_draw(struct client_ctx *cc) int width, height, width_size, width_name; snprintf(asize, sizeof(asize), "%dx%d", - (cc->geom.width - cc->geom.basew) / MAX(1, cc->geom.incw), - (cc->geom.height - cc->geom.baseh) / MAX(1, cc->geom.inch)); + (cc->geom.width - cc->geom.basew) / cc->geom.incw, + (cc->geom.height - cc->geom.baseh) / cc->geom.inch); width_size = font_width(asize, strlen(asize)) + 4; width_name = font_width(cc->name, strlen(cc->name)) + 4; width = MAX(width_size, width_name); -- cgit v1.2.3-2-gb3c3