summaryrefslogtreecommitdiffstats
path: root/view.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@10kloc.org>2006-09-29 12:38:27 +0200
committerAnselm R. Garbe <arg@10kloc.org>2006-09-29 12:38:27 +0200
commit14d05e7c725a4a07136ceb123cf760272afc1a87 (patch)
tree39328e09b357c05afb8951c5aaccaeb844b2b14d /view.c
parentrenamed column into area (diff)
downloaddwm-14d05e7c725a4a07136ceb123cf760272afc1a87.tar.gz
dwm-14d05e7c725a4a07136ceb123cf760272afc1a87.zip
first step to a more flexible dotile() algorithm
Diffstat (limited to 'view.c')
-rw-r--r--view.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/view.c b/view.c
index d3378ff..90080fb 100644
--- a/view.c
+++ b/view.c
@@ -65,6 +65,8 @@ togglemax(Client *c)
65/* extern */ 65/* extern */
66 66
67void (*arrange)(Arg *) = DEFMODE; 67void (*arrange)(Arg *) = DEFMODE;
68Bool isvertical = VERTICALSTACK;
69StackPos stackpos = STACKPOS;
68 70
69void 71void
70detach(Client *c) { 72detach(Client *c) {
@@ -97,35 +99,37 @@ dofloat(Arg *arg) {
97 99
98/* This algorithm is based on a (M)aster area and a (S)tacking area. 100/* This algorithm is based on a (M)aster area and a (S)tacking area.
99 * It supports following arrangements: 101 * It supports following arrangements:
100 * 102 * MMMS MMMM SMMM
101 * MMMS MMMM 103 * MMMS MMMM SMMM
102 * MMMS MMMM 104 * MMMS SSSS SMMM
103 * MMMS SSSS
104 *
105 * The stacking area can be set to arrange clients vertically or horizontally.
106 * Through inverting the algorithm it can be used to achieve following setup in
107 * a dual head environment (due to running two dwm instances concurrently on
108 * the specific screen):
109 *
110 * SMM MMS MMM MMM
111 * SMM MMS MMM MMM
112 * SMM MMS SSS SSS
113 *
114 * This uses the center of the two screens for master areas.
115 */ 105 */
116void 106void
117dotile(Arg *arg) { 107dotile(Arg *arg) {
118 int h, i, n, w; 108 int h, i, n, w;
119 Client *c; 109 Client *c;
120 110
121 w = sw - mw;
122 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) 111 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
123 n++; 112 n++;
124 113
125 if(n > 1) 114 if(isvertical) {
126 h = (sh - bh) / (n - 1); 115 if(stackpos == StackBottom) {
127 else 116 w = sw;
128 h = sh - bh; 117 if(n > 1)
118 h = (sh - bh) / (n - 1);
119 else
120 h = sh - bh;
121 }
122 else {
123 w = sw - master;
124 if(n > 1)
125 h = (sh - bh) / (n - 1);
126 else
127 h = sh - bh;
128 }
129 }
130 else { /* horizontal stack */
131
132 }
129 133
130 for(i = 0, c = clients; c; c = c->next) { 134 for(i = 0, c = clients; c; c = c->next) {
131 if(isvisible(c)) { 135 if(isvisible(c)) {
@@ -143,11 +147,11 @@ dotile(Arg *arg) {
143 else if(i == 0) { 147 else if(i == 0) {
144 c->x = sx; 148 c->x = sx;
145 c->y = sy + bh; 149 c->y = sy + bh;
146 c->w = mw - 2 * BORDERPX; 150 c->w = master - 2 * BORDERPX;
147 c->h = sh - 2 * BORDERPX - bh; 151 c->h = sh - 2 * BORDERPX - bh;
148 } 152 }
149 else if(h > bh) { 153 else if(h > bh) {
150 c->x = sx + mw; 154 c->x = sx + master;
151 c->y = sy + (i - 1) * h + bh; 155 c->y = sy + (i - 1) * h + bh;
152 c->w = w - 2 * BORDERPX; 156 c->w = w - 2 * BORDERPX;
153 if(i + 1 == n) 157 if(i + 1 == n)
@@ -156,7 +160,7 @@ dotile(Arg *arg) {
156 c->h = h - 2 * BORDERPX; 160 c->h = h - 2 * BORDERPX;
157 } 161 }
158 else { /* fallback if h < bh */ 162 else { /* fallback if h < bh */
159 c->x = sx + mw; 163 c->x = sx + master;
160 c->y = sy + bh; 164 c->y = sy + bh;
161 c->w = w - 2 * BORDERPX; 165 c->w = w - 2 * BORDERPX;
162 c->h = sh - 2 * BORDERPX - bh; 166 c->h = sh - 2 * BORDERPX - bh;
@@ -228,14 +232,14 @@ resizecol(Arg *arg) {
228 return; 232 return;
229 233
230 if(sel == getnext(clients)) { 234 if(sel == getnext(clients)) {
231 if(mw + arg->i > sw - 100 || mw + arg->i < 100) 235 if(master + arg->i > sw - 100 || master + arg->i < 100)
232 return; 236 return;
233 mw += arg->i; 237 master += arg->i;
234 } 238 }
235 else { 239 else {
236 if(mw - arg->i > sw - 100 || mw - arg->i < 100) 240 if(master - arg->i > sw - 100 || master - arg->i < 100)
237 return; 241 return;
238 mw -= arg->i; 242 master -= arg->i;
239 } 243 }
240 arrange(NULL); 244 arrange(NULL);
241} 245}