smart window size, initial patch

This commit is contained in:
Alexander Bocken 2020-08-24 01:43:26 +02:00
parent b042d98f22
commit 283044a191

View File

@ -6,12 +6,21 @@ fibonacci(Monitor *mon, int s) {
for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++); for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++);
if(n == 0) if(n == 0)
return; return;
nx = mon->wx; nx = mon->wx;
ny = 0; ny = 0;
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)
|| (!(i % 2) && nw / 2 > 2 * c->bw)) { || (!(i % 2) && nw / 2 > 2 * c->bw)) {
@ -44,7 +53,13 @@ fibonacci(Monitor *mon, int s) {
if(i == 0) if(i == 0)
{ {
if(n != 1) if(n != 1)
nw = mon->ww * mon->mfact;
nw = mon->ww *mon->mfact;
unsigned int altw = WIDTH(c) * mon->wh / HEIGHT(c);
nw = c->mina > 0 && altw < nw ? altw : nw;
//if ( c->mina > 0 && altw < nw){
// nw = altw;
//}
ny = mon->wy; ny = mon->wy;
} }
else if(i == 1) else if(i == 1)