applied Peter Hartlich's patch regarding aspect calculation with slight modifications
This commit is contained in:
parent
258c338030
commit
db5db8806f
19
dwm.c
19
dwm.c
|
@ -1046,23 +1046,34 @@ quit(const Arg *arg) {
|
||||||
|
|
||||||
void
|
void
|
||||||
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
||||||
|
float a;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
if(sizehints) {
|
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 */
|
/* set minimum possible */
|
||||||
w = MAX(1, w);
|
w = MAX(1, w);
|
||||||
h = MAX(1, h);
|
h = MAX(1, h);
|
||||||
|
|
||||||
/* temporarily remove base dimensions */
|
if(!baseismin) { /* temporarily remove base dimensions */
|
||||||
w -= c->basew;
|
w -= c->basew;
|
||||||
h -= c->baseh;
|
h -= c->baseh;
|
||||||
|
}
|
||||||
|
|
||||||
/* adjust for aspect limits */
|
/* adjust for aspect limits */
|
||||||
if(c->mina > 0 && c->maxa > 0) {
|
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;
|
w = h * c->maxa;
|
||||||
else if(c->mina > (float) h/w)
|
else if(a < c->mina)
|
||||||
h = w * c->mina;
|
h = w / c->mina;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(baseismin) { /* increment calculation requires this */
|
||||||
|
w -= c->basew;
|
||||||
|
h -= c->baseh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adjust for increment value */
|
/* adjust for increment value */
|
||||||
|
|
Loading…
Reference in a new issue