diff options
Diffstat (limited to '')
| -rw-r--r-- | tile.c | 102 |
1 files changed, 0 insertions, 102 deletions
| @@ -1,102 +0,0 @@ | |||
| 1 | /* See LICENSE file for copyright and license details. */ | ||
| 2 | int bx, by, bw, bh, blw, mx, my, mw, mh, tx, ty, tw, th, wx, wy, ww, wh; | ||
| 3 | |||
| 4 | void setmfact(const char *arg); | ||
| 5 | void tile(void); | ||
| 6 | void tileresize(Client *c, int x, int y, int w, int h); | ||
| 7 | void updatetilegeom(void); | ||
| 8 | |||
| 9 | void | ||
| 10 | setmfact(const char *arg) { | ||
| 11 | double d; | ||
| 12 | |||
| 13 | if(!arg || lt->arrange != tile) | ||
| 14 | return; | ||
| 15 | else { | ||
| 16 | d = strtod(arg, NULL); | ||
| 17 | if(arg[0] == '-' || arg[0] == '+') | ||
| 18 | d += mfact; | ||
| 19 | if(d < 0.1 || d > 0.9) | ||
| 20 | return; | ||
| 21 | mfact = d; | ||
| 22 | } | ||
| 23 | updatetilegeom(); | ||
| 24 | arrange(); | ||
| 25 | } | ||
| 26 | |||
| 27 | void | ||
| 28 | tile(void) { | ||
| 29 | int x, y, h, w; | ||
| 30 | unsigned int i, n; | ||
| 31 | Client *c; | ||
| 32 | |||
| 33 | for(n = 0, c = nextunfloating(clients); c; c = nextunfloating(c->next), n++); | ||
| 34 | if(n == 0) | ||
| 35 | return; | ||
| 36 | |||
| 37 | /* master */ | ||
| 38 | c = nextunfloating(clients); | ||
| 39 | |||
| 40 | if(n == 1) | ||
| 41 | tileresize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw); | ||
| 42 | else | ||
| 43 | tileresize(c, mx, my, mw - 2 * c->bw, mh - 2 * c->bw); | ||
| 44 | |||
| 45 | if(--n == 0) | ||
| 46 | return; | ||
| 47 | |||
| 48 | /* tile stack */ | ||
| 49 | x = (tx > c->x + c->w) ? c->x + c->w + 2 * c->bw : tw; | ||
| 50 | y = ty; | ||
| 51 | w = (tx > c->x + c->w) ? wx + ww - x : tw; | ||
| 52 | h = th / n; | ||
| 53 | if(h < bh) | ||
| 54 | h = th; | ||
| 55 | |||
| 56 | for(i = 0, c = nextunfloating(c->next); c; c = nextunfloating(c->next), i++) { | ||
| 57 | if(i + 1 == n) /* remainder */ | ||
| 58 | tileresize(c, x, y, w - 2 * c->bw, (ty + th) - y - 2 * c->bw); | ||
| 59 | else | ||
| 60 | tileresize(c, x, y, w - 2 * c->bw, h - 2 * c->bw); | ||
| 61 | if(h != th) | ||
| 62 | y = c->y + c->h + 2 * c->bw; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | void | ||
| 67 | tileresize(Client *c, int x, int y, int w, int h) { | ||
| 68 | resize(c, x, y, w, h, resizehints); | ||
| 69 | if(resizehints && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w))) | ||
| 70 | /* client doesn't accept size constraints */ | ||
| 71 | resize(c, x, y, w, h, False); | ||
| 72 | } | ||
| 73 | |||
| 74 | void | ||
| 75 | zoom(const char *arg) { | ||
| 76 | Client *c = sel; | ||
| 77 | |||
| 78 | if(c == nextunfloating(clients)) | ||
| 79 | if(!c || !(c = nextunfloating(c->next))) | ||
| 80 | return; | ||
| 81 | if(lt->arrange == tile && !sel->isfloating) { | ||
| 82 | detach(c); | ||
| 83 | attach(c); | ||
| 84 | focus(c); | ||
| 85 | } | ||
| 86 | arrange(); | ||
| 87 | } | ||
| 88 | |||
| 89 | void | ||
| 90 | updatetilegeom(void) { | ||
| 91 | /* master area geometry */ | ||
| 92 | mx = wx; | ||
| 93 | my = wy; | ||
| 94 | mw = mfact * ww; | ||
| 95 | mh = wh; | ||
| 96 | |||
| 97 | /* tile area geometry */ | ||
| 98 | tx = mx + mw; | ||
| 99 | ty = wy; | ||
| 100 | tw = ww - mw; | ||
| 101 | th = wh; | ||
| 102 | } | ||
