summaryrefslogtreecommitdiff
path: root/src/manage.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2006-03-11 00:31:30 +0000
committersabetts <sabetts>2006-03-11 00:31:30 +0000
commitb4e487088b12037e4500b0d03e77340e82b6198f (patch)
treed82b151cd2b2407756838ff5bc9270a283fa0167 /src/manage.c
parentc37b647396a065eb4928257452c785f148bcae50 (diff)
downloadratpoison-b4e487088b12037e4500b0d03e77340e82b6198f.zip
*** empty log message ***
Diffstat (limited to 'src/manage.c')
-rw-r--r--src/manage.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/src/manage.c b/src/manage.c
index 364c6c9..5955137 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -649,17 +649,24 @@ maximize_transient (rp_window *win)
int amount;
int delta;
- amount = maxx - win->width;
- delta = amount % win->hints->width_inc;
- amount -= delta;
- if (amount < 0 && delta) amount -= win->hints->width_inc;
- maxx = amount + win->width;
+ /* Avoid a divide by zero if width/height_inc is 0. */
+ if (win->hints->width_inc)
+ {
+ amount = maxx - win->width;
+ delta = amount % win->hints->width_inc;
+ amount -= delta;
+ if (amount < 0 && delta) amount -= win->hints->width_inc;
+ maxx = amount + win->width;
+ }
- amount = maxy - win->height;
- delta = amount % win->hints->height_inc;
- amount -= delta;
- if (amount < 0 && delta) amount -= win->hints->height_inc;
- maxy = amount + win->height;
+ if (win->hints->height_inc)
+ {
+ amount = maxy - win->height;
+ delta = amount % win->hints->height_inc;
+ amount -= delta;
+ if (amount < 0 && delta) amount -= win->hints->height_inc;
+ maxy = amount + win->height;
+ }
}
PRINT_DEBUG (("maxsize: %d %d\n", maxx, maxy));
@@ -733,17 +740,23 @@ maximize_normal (rp_window *win)
int amount;
int delta;
- amount = maxx - win->width;
- delta = amount % win->hints->width_inc;
- if (amount < 0 && delta) amount -= win->hints->width_inc;
- amount -= delta;
- maxx = amount + win->width;
-
- amount = maxy - win->height;
- delta = amount % win->hints->height_inc;
- if (amount < 0 && delta) amount -= win->hints->height_inc;
- amount -= delta;
- maxy = amount + win->height;
+ if (win->hints->width_inc)
+ {
+ amount = maxx - win->width;
+ delta = amount % win->hints->width_inc;
+ if (amount < 0 && delta) amount -= win->hints->width_inc;
+ amount -= delta;
+ maxx = amount + win->width;
+ }
+
+ if (win->hints->height_inc)
+ {
+ amount = maxy - win->height;
+ delta = amount % win->hints->height_inc;
+ if (amount < 0 && delta) amount -= win->hints->height_inc;
+ amount -= delta;
+ maxy = amount + win->height;
+ }
}
PRINT_DEBUG (("maxsize: %d %d\n", maxx, maxy));