summaryrefslogtreecommitdiffstats
path: root/tile.c
diff options
context:
space:
mode:
authoranselm@anselm1 <unknown>2008-05-19 20:07:12 +0100
committeranselm@anselm1 <unknown>2008-05-19 20:07:12 +0100
commit822101dd5bceadb12351dd5f9084d7745b10ec92 (patch)
treec9ed3b1c3181b4be933c826834688fc510365393 /tile.c
parenttake bar into account (diff)
downloaddwm-822101dd5bceadb12351dd5f9084d7745b10ec92.tar.gz
dwm-822101dd5bceadb12351dd5f9084d7745b10ec92.zip
merged tile.c again into dwm.c
Diffstat (limited to '')
-rw-r--r--tile.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/tile.c b/tile.c
deleted file mode 100644
index 8269676..0000000
--- a/tile.c
+++ /dev/null
@@ -1,102 +0,0 @@
1/* See LICENSE file for copyright and license details. */
2int bx, by, bw, bh, blw, mx, my, mw, mh, tx, ty, tw, th, wx, wy, ww, wh;
3
4void setmfact(const char *arg);
5void tile(void);
6void tileresize(Client *c, int x, int y, int w, int h);
7void updatetilegeom(void);
8
9void
10setmfact(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
27void
28tile(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
66void
67tileresize(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
74void
75zoom(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
89void
90updatetilegeom(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}