[hackers] [dwm] applied Peter Hartlich's patch regarding aspect calculation with slight modifications || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Sat, 23 Aug 2008 08:54:59 +0000 (UTC)

changeset: 1342:a2f37186527c
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Sat Aug 23 09:54:55 2008 +0100
files: dwm.c
description:
applied Peter Hartlich's patch regarding aspect calculation with slight modifications

diff -r 8aa84340b558 -r a2f37186527c dwm.c
--- a/dwm.c Sat Aug 23 09:33:05 2008 +0100
+++ b/dwm.c Sat Aug 23 09:54:55 2008 +0100
@@ -1046,23 +1046,34 @@
 
 void
 resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
+ float a;
         XWindowChanges wc;
 
         if(sizehints) {
+ /* see last two sentences in ICCCM 4.1.2.3 */
+ Bool baseismin = c->basew == c->minw && c->baseh == c->minh;
+
                 /* set minimum possible */
                 w = MAX(1, w);
                 h = MAX(1, h);
 
- /* temporarily remove base dimensions */
- w -= c->basew;
- h -= c->baseh;
+ if(!baseismin) { /* temporarily remove base dimensions */
+ w -= c->basew;
+ h -= c->baseh;
+ }
 
                 /* adjust for aspect limits */
                 if(c->mina > 0 && c->maxa > 0) {
- if(c->maxa < (float) w/h)
+ a = (float) w/h;
+ if(a > c->maxa)
                                 w = h * c->maxa;
- else if(c->mina > (float) h/w)
- h = w * c->mina;
+ else if(a < c->mina)
+ h = w / c->mina;
+ }
+
+ if(baseismin) { /* increment calculation requires this */
+ w -= c->basew;
+ h -= c->baseh;
                 }
 
                 /* adjust for increment value */
Received on Sat Aug 23 2008 - 08:54:59 UTC

This archive was generated by hypermail 2.2.0 : Sat Aug 23 2008 - 09:00:08 UTC