smart window placement, slightly improved for fib
This commit is contained in:
parent
283044a191
commit
b18a6e35f2
30
fibonacci.c
30
fibonacci.c
@ -12,14 +12,7 @@ fibonacci(Monitor *mon, int s) {
|
|||||||
nw = mon->ww;
|
nw = mon->ww;
|
||||||
nh = mon->wh;
|
nh = mon->wh;
|
||||||
|
|
||||||
if(n==1){
|
|
||||||
c = nexttiled(mon->clients);
|
|
||||||
int altw = WIDTH(c)*mon->wh/HEIGHT(c);
|
|
||||||
if ( c->mina > 0 && altw < c->mon->mw ){
|
|
||||||
nx = c->mon->mx + (c->mon->mw - altw ) / 2;
|
|
||||||
resize(c, nx, ny, nw , nh , False);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) {
|
for(i = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) {
|
||||||
if((i % 2 && nh / 2 > 2 * c->bw)
|
if((i % 2 && nh / 2 > 2 * c->bw)
|
||||||
@ -52,15 +45,18 @@ fibonacci(Monitor *mon, int s) {
|
|||||||
}
|
}
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
if(n != 1)
|
unsigned int altw = WIDTH(c) * mon->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */
|
||||||
|
if( n==1 ){
|
||||||
nw = mon->ww *mon->mfact;
|
//if window has min aspect ratio (aka not infinitely adjustable to screen), center that window
|
||||||
unsigned int altw = WIDTH(c) * mon->wh / HEIGHT(c);
|
if ( c->mina > 0 && altw < c->mon->mw ){
|
||||||
nw = c->mina > 0 && altw < nw ? altw : nw;
|
nx = c->mon->mx + (c->mon->mw - altw ) / 2;
|
||||||
//if ( c->mina > 0 && altw < nw){
|
}
|
||||||
// nw = altw;
|
}
|
||||||
//}
|
else{
|
||||||
ny = mon->wy;
|
nw = mon->ww *mon->mfact;
|
||||||
|
nw = c->mina > 0 && altw < nw ? altw : nw;
|
||||||
|
ny = mon->wy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(i == 1)
|
else if(i == 1)
|
||||||
nw = mon->ww - nw;
|
nw = mon->ww - nw;
|
||||||
|
Loading…
Reference in New Issue
Block a user