fix resizing to 0 from aspect ratios
This commit is contained in:
parent
a434669d17
commit
f9c659c12c
1 changed files with 29 additions and 10 deletions
|
@ -1953,27 +1953,46 @@ void client_configure_full(ObClient *self, ObCorner anchor,
|
||||||
h -= self->base_size.height;
|
h -= self->base_size.height;
|
||||||
|
|
||||||
if (self->min_ratio)
|
if (self->min_ratio)
|
||||||
if (h * self->min_ratio > w) h = (int)(w / self->min_ratio);
|
if (h * self->min_ratio > w) {
|
||||||
|
h = (int)(w / self->min_ratio);
|
||||||
|
|
||||||
|
/* you cannot resize to nothing */
|
||||||
|
if (h < 1) {
|
||||||
|
h = 1;
|
||||||
|
w = (int)(h * self->min_ratio);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (self->max_ratio)
|
if (self->max_ratio)
|
||||||
if (h * self->max_ratio < w) h = (int)(w / self->max_ratio);
|
if (h * self->max_ratio < w) {
|
||||||
|
h = (int)(w / self->max_ratio);
|
||||||
|
|
||||||
|
/* you cannot resize to nothing */
|
||||||
|
if (h < 1) {
|
||||||
|
h = 1;
|
||||||
|
w = (int)(h * self->min_ratio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
w += self->base_size.width;
|
w += self->base_size.width;
|
||||||
h += self->base_size.height;
|
h += self->base_size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_assert(w > 0);
|
||||||
|
g_assert(h > 0);
|
||||||
|
|
||||||
switch (anchor) {
|
switch (anchor) {
|
||||||
case OB_CORNER_TOPLEFT:
|
case OB_CORNER_TOPLEFT:
|
||||||
break;
|
break;
|
||||||
case OB_CORNER_TOPRIGHT:
|
case OB_CORNER_TOPRIGHT:
|
||||||
x -= w - self->area.width;
|
x -= w - self->area.width;
|
||||||
break;
|
break;
|
||||||
case OB_CORNER_BOTTOMLEFT:
|
case OB_CORNER_BOTTOMLEFT:
|
||||||
y -= h - self->area.height;
|
y -= h - self->area.height;
|
||||||
break;
|
break;
|
||||||
case OB_CORNER_BOTTOMRIGHT:
|
case OB_CORNER_BOTTOMRIGHT:
|
||||||
x -= w - self->area.width;
|
x -= w - self->area.width;
|
||||||
y -= h - self->area.height;
|
y -= h - self->area.height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
moved = x != self->area.x || y != self->area.y;
|
moved = x != self->area.x || y != self->area.y;
|
||||||
|
|
Loading…
Reference in a new issue