diff options
| author | Anselm R. Garbe <arg@suckless.org> | 2007-05-24 15:40:07 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@suckless.org> | 2007-05-24 15:40:07 +0200 |
| commit | e45b3ced673e2de583c53e084cc071039d64ba4e (patch) | |
| tree | 4cb6b9eac36d265dbb27bcdfce5aba8b9a9238b6 /layout.c | |
| parent | fixed issue reported by Christian Garbs (diff) | |
| download | dwm-e45b3ced673e2de583c53e084cc071039d64ba4e.tar.gz dwm-e45b3ced673e2de583c53e084cc071039d64ba4e.zip | |
calculating the remainder for master and stack area correctly
Diffstat (limited to 'layout.c')
| -rw-r--r-- | layout.c | 15 |
1 files changed, 9 insertions, 6 deletions
| @@ -15,7 +15,7 @@ static unsigned int nmaster = NMASTER; | |||
| 15 | 15 | ||
| 16 | static void | 16 | static void |
| 17 | tile(void) { | 17 | tile(void) { |
| 18 | unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th, remainder; | 18 | unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; |
| 19 | Client *c; | 19 | Client *c; |
| 20 | 20 | ||
| 21 | for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) | 21 | for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
| @@ -24,7 +24,6 @@ tile(void) { | |||
| 24 | mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); | 24 | mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); |
| 25 | mw = (n > nmaster) ? (waw * masterw) / 1000 : waw; | 25 | mw = (n > nmaster) ? (waw * masterw) / 1000 : waw; |
| 26 | th = (n > nmaster) ? wah / (n - nmaster) : 0; | 26 | th = (n > nmaster) ? wah / (n - nmaster) : 0; |
| 27 | remainder = (n > nmaster) ? wah - th * (n - nmaster) : 0; | ||
| 28 | tw = waw - mw; | 27 | tw = waw - mw; |
| 29 | 28 | ||
| 30 | for(i = 0, c = clients; c; c = c->next) | 29 | for(i = 0, c = clients; c; c = c->next) |
| @@ -40,16 +39,20 @@ tile(void) { | |||
| 40 | if(i < nmaster) { | 39 | if(i < nmaster) { |
| 41 | ny += i * mh; | 40 | ny += i * mh; |
| 42 | nw = mw - 2 * c->border; | 41 | nw = mw - 2 * c->border; |
| 43 | nh = mh - 2 * c->border; | 42 | nh = mh; |
| 43 | if(i + 1 == nmaster) /* remainder */ | ||
| 44 | nh = wah - mh * i; | ||
| 45 | nh -= 2 * c->border; | ||
| 44 | } | 46 | } |
| 45 | else { /* tile window */ | 47 | else { /* tile window */ |
| 46 | nx += mw; | 48 | nx += mw; |
| 47 | nw = tw - 2 * c->border; | 49 | nw = tw - 2 * c->border; |
| 48 | if(th > 2 * c->border) { | 50 | if(th > 2 * c->border) { |
| 49 | ny += (i - nmaster) * th; | 51 | ny += (i - nmaster) * th; |
| 50 | nh = th - 2 * c->border; | 52 | nh = th; |
| 51 | if (i == n - 1) | 53 | if(i + 1 == n) /* remainder */ |
| 52 | nh += remainder; | 54 | nh = wah - th * (i - nmaster); |
| 55 | nh -= 2 * c->border; | ||
| 53 | } | 56 | } |
| 54 | else /* fallback if th <= 2 * c->border */ | 57 | else /* fallback if th <= 2 * c->border */ |
| 55 | nh = wah - 2 * c->border; | 58 | nh = wah - 2 * c->border; |
