equal
deleted
inserted
replaced
1044 readin = running = False; |
1044 readin = running = False; |
1045 } |
1045 } |
1046 |
1046 |
1047 void |
1047 void |
1048 resize(Client *c, int x, int y, int w, int h, Bool sizehints) { |
1048 resize(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 */ |
1069 if(c->incw) |
1080 if(c->incw) |
1070 w -= w % c->incw; |
1081 w -= w % c->incw; |