Browse Source

Handle single windows better

master
= 3 years ago
parent
commit
6f7eb44955
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      dwm.c

+ 9
- 7
dwm.c View File

@@ -1778,6 +1778,7 @@ setoutergaps(const Arg *arg)
p->ogap = p->ogap * p->isgap; p->ogap = p->ogap * p->isgap;
arrange(selmon); arrange(selmon);
} }

void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
@@ -1963,24 +1964,25 @@ tile(Monitor *m)
mw = m->ww - m->gap->gappx; mw = m->ww - m->gap->gappx;
for (i = 0, my = ty = m->gap->ogap, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) for (i = 0, my = ty = m->gap->ogap, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) { if (i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gap->gappx ;
xposition = m->wx + m->gap->ogap; xposition = m->wx + m->gap->ogap;
yposition = m->wy + my - (m->gap->ogap / 2); yposition = m->wy + my - (m->gap->ogap / 2);
xlength = mw - (2*c->bw) - m->gap->gappx - m->gap->ogap;
ylength = h - (2*c->bw);


if (m->nmaster == 1) { if (m->nmaster == 1) {
yposition = m->wy + my - (m->gap->ogap / 2); yposition = m->wy + my - (m->gap->ogap / 2);
} }


h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gap->gappx ;

xlength = mw - (2*c->bw) - m->gap->gappx;
ylength = h - (2*c->bw);
if (m->nmaster >= n)
xlength = mw - (2*c->bw) - m->gap->gappx - 2*m->gap->ogap;


resize(c, xposition, yposition, xlength, ylength, 0); resize(c, xposition, yposition, xlength, ylength, 0);
if (my + HEIGHT(c) + m->gap->gappx < m->wh) if (my + HEIGHT(c) + m->gap->gappx < m->wh)
my += HEIGHT(c) + m->gap->gappx; my += HEIGHT(c) + m->gap->gappx;
} else { } else {
if (i == n - 1) { if (i == n - 1) {
h = (m->wh - ty) / (n - i) - m->gap->ogap; //+ m->gap->gappx / (n - m->nmaster);
h = (m->wh - ty) / (n - i) - m->gap->ogap;
} else { } else {
h = (m->wh - ty) / (n - i) - m->gap->gappx; h = (m->wh - ty) / (n - i) - m->gap->gappx;
} }
@@ -1991,8 +1993,8 @@ tile(Monitor *m)
yposition = m->wy + ty - (m->gap->ogap / 2); yposition = m->wy + ty - (m->gap->ogap / 2);
} }


xposition = m->wx + mw + m->gap->ogap + m->gap->gappx;
xlength = m->ww - mw - (2*c->bw) - 2*m->gap->ogap - m->gap->gappx;
xposition = m->wx + mw; //+ m->gap->gappx;
xlength = m->ww - mw - (2*c->bw) - m->gap->ogap;
ylength = h - (2*c->bw); ylength = h - (2*c->bw);
resize(c, xposition, yposition, xlength, ylength, 0); resize(c, xposition, yposition, xlength, ylength, 0);
if (ty + HEIGHT(c) + m->gap->gappx < m->wh) if (ty + HEIGHT(c) + m->gap->gappx < m->wh)


Loading…
Cancel
Save