summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-09-28 07:38:55 +0000
committerDana Jansens <danakj@orodu.net>2003-09-28 07:38:55 +0000
commitf9c659c12c7f387133b76a89e38dd48bba1b8172 (patch)
tree756205eba5bf3ebe4b3cb699c48e88391ce7ceed
parenta434669d1762cd97a0af8ab8f4717f3d563f8ec6 (diff)
fix resizing to 0 from aspect ratios
-rw-r--r--openbox/client.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/openbox/client.c b/openbox/client.c
index 5cd6339f..a17c73da 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -1953,27 +1953,46 @@ void client_configure_full(ObClient *self, ObCorner anchor,
h -= self->base_size.height;
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 (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;
h += self->base_size.height;
}
+ g_assert(w > 0);
+ g_assert(h > 0);
+
switch (anchor) {
case OB_CORNER_TOPLEFT:
- break;
+ break;
case OB_CORNER_TOPRIGHT:
- x -= w - self->area.width;
- break;
+ x -= w - self->area.width;
+ break;
case OB_CORNER_BOTTOMLEFT:
- y -= h - self->area.height;
- break;
+ y -= h - self->area.height;
+ break;
case OB_CORNER_BOTTOMRIGHT:
- x -= w - self->area.width;
- y -= h - self->area.height;
- break;
+ x -= w - self->area.width;
+ y -= h - self->area.height;
+ break;
}
moved = x != self->area.x || y != self->area.y;