|
|
@ -99,36 +99,39 @@ dofloat(Arg *arg) {
|
|
|
|
|
|
|
|
|
|
|
|
/* This algorithm is based on a (M)aster area and a (S)tacking area.
|
|
|
|
/* This algorithm is based on a (M)aster area and a (S)tacking area.
|
|
|
|
* It supports following arrangements:
|
|
|
|
* It supports following arrangements:
|
|
|
|
* MMMS MMMM SMMM
|
|
|
|
* SSMMM MMMMM MMMSS
|
|
|
|
* MMMS MMMM SMMM
|
|
|
|
* SSMMM SSSSS MMMSS
|
|
|
|
* MMMS SSSS SMMM
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
void
|
|
|
|
dotile(Arg *arg) {
|
|
|
|
dotile(Arg *arg) {
|
|
|
|
int h, i, n, w;
|
|
|
|
int i, n, stackw, stackh, tw, th;
|
|
|
|
Client *c;
|
|
|
|
Client *c;
|
|
|
|
|
|
|
|
|
|
|
|
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
|
|
|
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
|
|
|
n++;
|
|
|
|
n++;
|
|
|
|
|
|
|
|
|
|
|
|
if(isvertical) {
|
|
|
|
|
|
|
|
if(stackpos == StackBottom) {
|
|
|
|
if(stackpos == StackBottom) {
|
|
|
|
w = sw;
|
|
|
|
stackw = sw;
|
|
|
|
|
|
|
|
stackh = sh - bh - master;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
stackw = sw - master;
|
|
|
|
|
|
|
|
stackh = sh - bh;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isvertical) {
|
|
|
|
|
|
|
|
tw = stackw;
|
|
|
|
if(n > 1)
|
|
|
|
if(n > 1)
|
|
|
|
h = (sh - bh) / (n - 1);
|
|
|
|
th = stackh / (n - 1);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
h = sh - bh;
|
|
|
|
th = stackh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
w = sw - master;
|
|
|
|
th = stackh;
|
|
|
|
if(n > 1)
|
|
|
|
if(n > 1)
|
|
|
|
h = (sh - bh) / (n - 1);
|
|
|
|
tw = stackw / (n - 1);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
h = sh - bh;
|
|
|
|
tw = stackw;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else { /* horizontal stack */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(i = 0, c = clients; c; c = c->next) {
|
|
|
|
for(i = 0, c = clients; c; c = c->next) {
|
|
|
@ -138,32 +141,59 @@ dotile(Arg *arg) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c->ismax = False;
|
|
|
|
c->ismax = False;
|
|
|
|
if(n == 1) {
|
|
|
|
if(n == 1) { /* only 1 window */
|
|
|
|
c->x = sx;
|
|
|
|
c->x = sx;
|
|
|
|
c->y = sy + bh;
|
|
|
|
c->y = sy + bh;
|
|
|
|
c->w = sw - 2 * BORDERPX;
|
|
|
|
c->w = sw - 2 * BORDERPX;
|
|
|
|
c->h = sh - 2 * BORDERPX - bh;
|
|
|
|
c->h = sh - 2 * BORDERPX - bh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(i == 0) {
|
|
|
|
else if(i == 0) { /* master window */
|
|
|
|
c->x = sx;
|
|
|
|
c->x = sx;
|
|
|
|
|
|
|
|
if(stackpos == StackLeft)
|
|
|
|
|
|
|
|
c->x += master;
|
|
|
|
c->y = sy + bh;
|
|
|
|
c->y = sy + bh;
|
|
|
|
|
|
|
|
if(isvertical) {
|
|
|
|
c->w = master - 2 * BORDERPX;
|
|
|
|
c->w = master - 2 * BORDERPX;
|
|
|
|
c->h = sh - 2 * BORDERPX - bh;
|
|
|
|
c->h = sh - 2 * BORDERPX - bh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(h > bh) {
|
|
|
|
else {
|
|
|
|
c->x = sx + master;
|
|
|
|
c->w = sw;
|
|
|
|
c->y = sy + (i - 1) * h + bh;
|
|
|
|
c->h = master - 2 * BORDERPX;
|
|
|
|
c->w = w - 2 * BORDERPX;
|
|
|
|
}
|
|
|
|
if(i + 1 == n)
|
|
|
|
}
|
|
|
|
|
|
|
|
else if((isvertical && th > bh) || (!isvertical && tw > MINW)) {
|
|
|
|
|
|
|
|
/* tile window */
|
|
|
|
|
|
|
|
c->x = sx;
|
|
|
|
|
|
|
|
if(isvertical)
|
|
|
|
|
|
|
|
c->y = sy + (i - 1) * th + bh;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
c->y = sy + bh;
|
|
|
|
|
|
|
|
if(stackpos == StackRight)
|
|
|
|
|
|
|
|
c->x += master;
|
|
|
|
|
|
|
|
else if(stackpos == StackBottom)
|
|
|
|
|
|
|
|
c->y += master;
|
|
|
|
|
|
|
|
c->w = tw - 2 * BORDERPX;
|
|
|
|
|
|
|
|
c->h = th - 2 * BORDERPX;
|
|
|
|
|
|
|
|
if(i + 1 == n) { /* fixes for last tile to take up rest space */
|
|
|
|
|
|
|
|
if(isvertical)
|
|
|
|
c->h = sh - c->y - 2 * BORDERPX;
|
|
|
|
c->h = sh - c->y - 2 * BORDERPX;
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
if(stackpos == StackLeft)
|
|
|
|
|
|
|
|
c->w = master - c->x - 2 * BORDERPX;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
c->h = h - 2 * BORDERPX;
|
|
|
|
c->w = sw - c->x - 2 * BORDERPX;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { /* fallback if h < bh */
|
|
|
|
else { /* fallback if th < bh resp. tw < MINW */
|
|
|
|
c->x = sx + master;
|
|
|
|
c->x = sx;
|
|
|
|
c->y = sy + bh;
|
|
|
|
c->y = sy + bh;
|
|
|
|
c->w = w - 2 * BORDERPX;
|
|
|
|
if(stackpos == StackRight)
|
|
|
|
c->h = sh - 2 * BORDERPX - bh;
|
|
|
|
c->x += master;
|
|
|
|
|
|
|
|
else if(stackpos == StackBottom)
|
|
|
|
|
|
|
|
c->y += master;
|
|
|
|
|
|
|
|
c->w = stackw - 2 * BORDERPX;
|
|
|
|
|
|
|
|
c->h = stackh - 2 * BORDERPX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resize(c, False, TopLeft);
|
|
|
|
resize(c, False, TopLeft);
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
@ -232,12 +262,12 @@ resizecol(Arg *arg) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if(sel == getnext(clients)) {
|
|
|
|
if(sel == getnext(clients)) {
|
|
|
|
if(master + arg->i > sw - 100 || master + arg->i < 100)
|
|
|
|
if(master + arg->i > sw - MINW || master + arg->i < MINW)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
master += arg->i;
|
|
|
|
master += arg->i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
if(master - arg->i > sw - 100 || master - arg->i < 100)
|
|
|
|
if(master - arg->i > sw - MINW || master - arg->i < MINW)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
master -= arg->i;
|
|
|
|
master -= arg->i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|