aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dwm.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/dwm.c b/dwm.c
index ab3a84c..5ff6fd4 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1968,32 +1968,32 @@ updatesizehints(Client *c)
/* size is uninitialized, ensure that size.flags aren't used */
size.flags = PSize;
if (size.flags & PBaseSize) {
- c->basew = size.base_width;
- c->baseh = size.base_height;
+ c->basew = MAX(0, size.base_width);
+ c->baseh = MAX(0, size.base_height);
} else if (size.flags & PMinSize) {
- c->basew = size.min_width;
- c->baseh = size.min_height;
+ c->basew = MAX(0, size.min_width);
+ c->baseh = MAX(0, size.min_height);
} else
c->basew = c->baseh = 0;
if (size.flags & PResizeInc) {
- c->incw = size.width_inc;
- c->inch = size.height_inc;
+ c->incw = MAX(0, size.width_inc);
+ c->inch = MAX(0, size.height_inc);
} else
c->incw = c->inch = 0;
if (size.flags & PMaxSize) {
- c->maxw = size.max_width;
- c->maxh = size.max_height;
+ c->maxw = MAX(0, size.max_width);
+ c->maxh = MAX(0, size.max_height);
} else
c->maxw = c->maxh = 0;
if (size.flags & PMinSize) {
- c->minw = size.min_width;
- c->minh = size.min_height;
+ c->minw = MAX(0, size.min_width);
+ c->minh = MAX(0, size.min_height);
} else if (size.flags & PBaseSize) {
- c->minw = size.base_width;
- c->minh = size.base_height;
+ c->minw = MAX(0, size.base_width);
+ c->minh = MAX(0, size.base_height);
} else
c->minw = c->minh = 0;
- if (size.flags & PAspect) {
+ if ((size.flags & PAspect) && size.min_aspect.x > 0 && size.max_aspect.y > 0) {
c->mina = (float)size.min_aspect.y / size.min_aspect.x;
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
} else