inital patch for deck/tile smart adjustment
This commit is contained in:
parent
b18a6e35f2
commit
36cbf6658f
36
dwm.c
36
dwm.c
@ -673,15 +673,28 @@ createmon(void)
|
|||||||
|
|
||||||
void
|
void
|
||||||
deck(Monitor *m) {
|
deck(Monitor *m) {
|
||||||
unsigned int i, n, h, mw, my;
|
unsigned int i, n, h, mw, my, altw, nx;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
if(n == 0)
|
if(n == 0)
|
||||||
return;
|
return;
|
||||||
|
if (n == 1){
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
altw = WIDTH(c) * m->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */
|
||||||
|
if ( c->mina > 0 && altw < c->mon->mw ){
|
||||||
|
nx = m->mx + (m->mw - altw ) / 2;
|
||||||
|
resize(c, nx , c->y, altw , c->h, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(n > m->nmaster) {
|
if(n > m->nmaster) {
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
if ( m->nmaster == 1){
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
altw = WIDTH(c) * m->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */
|
||||||
|
mw = c->mina > 0 && altw < mw ? altw : mw;
|
||||||
|
}
|
||||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
|
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1750,15 +1763,30 @@ tagmon(const Arg *arg)
|
|||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n, h, mw, my, ty;
|
unsigned int i, n, h, mw, my, ty, altw, nx;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
if (n == 1){
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
altw = WIDTH(c) * m->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */
|
||||||
|
if ( c->mina > 0 && altw < c->mon->mw ){
|
||||||
|
nx = m->mx + (m->mw - altw ) / 2;
|
||||||
|
resize(c, nx , c->y, altw , c->h, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (n > m->nmaster)
|
if (n > m->nmaster){
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
if ( m->nmaster == 1){
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
altw = WIDTH(c) * m->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */
|
||||||
|
mw = c->mina > 0 && altw < mw ? altw : mw;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mw = m->ww;
|
mw = m->ww;
|
||||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user