summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-08-23 09:54:55 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-08-23 09:54:55 +0100
commitdb5db8806f4bbb26bb1259f7ea42d7a826517bbb (patch)
treec7d1e0e25c6f3536928fce515d8495d38b50f8cc
parentremoved artifact from wmii (diff)
downloaddwm-db5db8806f4bbb26bb1259f7ea42d7a826517bbb.tar.gz
dwm-db5db8806f4bbb26bb1259f7ea42d7a826517bbb.zip
applied Peter Hartlich's patch regarding aspect calculation with slight modifications
Diffstat (limited to '')
-rw-r--r--dwm.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/dwm.c b/dwm.c
index ba24d9a..ae2952b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1046,23 +1046,34 @@ quit(const Arg *arg) {
1046 1046
1047void 1047void
1048resize(Client *c, int x, int y, int w, int h, Bool sizehints) { 1048resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
1049 float a;
1049 XWindowChanges wc; 1050 XWindowChanges wc;
1050 1051
1051 if(sizehints) { 1052 if(sizehints) {
1053 /* see last two sentences in ICCCM 4.1.2.3 */
1054 Bool baseismin = c->basew == c->minw && c->baseh == c->minh;
1055
1052 /* set minimum possible */ 1056 /* set minimum possible */
1053 w = MAX(1, w); 1057 w = MAX(1, w);
1054 h = MAX(1, h); 1058 h = MAX(1, h);
1055 1059
1056 /* temporarily remove base dimensions */ 1060 if(!baseismin) { /* temporarily remove base dimensions */
1057 w -= c->basew; 1061 w -= c->basew;
1058 h -= c->baseh; 1062 h -= c->baseh;
1063 }
1059 1064
1060 /* adjust for aspect limits */ 1065 /* adjust for aspect limits */
1061 if(c->mina > 0 && c->maxa > 0) { 1066 if(c->mina > 0 && c->maxa > 0) {
1062 if(c->maxa < (float) w/h) 1067 a = (float) w/h;
1068 if(a > c->maxa)
1063 w = h * c->maxa; 1069 w = h * c->maxa;
1064 else if(c->mina > (float) h/w) 1070 else if(a < c->mina)
1065 h = w * c->mina; 1071 h = w / c->mina;
1072 }
1073
1074 if(baseismin) { /* increment calculation requires this */
1075 w -= c->basew;
1076 h -= c->baseh;
1066 } 1077 }
1067 1078
1068 /* adjust for increment value */ 1079 /* adjust for increment value */