Merge branch 'patch-noborder' into custom-dwm

This commit is contained in:
lhark 2016-11-14 20:06:14 -05:00
commit b72a0746f3

41
dwm.c
View file

@ -431,9 +431,24 @@ arrange(Monitor *m)
void
arrangemon(Monitor *m)
{
int n = 0;
Client *c;
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
if (m->lt[m->sellt]->arrange)
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if ((m->lt[m->sellt]->arrange != monocle && n > 1) || !m->lt[m->sellt]->arrange) {
for (c = m->clients; c; c = c->next) {
if (ISVISIBLE(c) && (!m->lt[m->sellt]->arrange || !c->isfloating) && (c->bw != borderpx)) {
c->oldbw = c->bw;
c->bw = borderpx;
resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw));
}
}
if (m->lt[m->sellt]->arrange) {
m->lt[m->sellt]->arrange(m);
}
} else {
monocle(m);
}
}
void
@ -1256,10 +1271,19 @@ monocle(Monitor *m)
for (c = m->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
if (n > 0) /* override layout symbol */
if (n > 0 && m->lt[m->sellt]->arrange == monocle) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
// I'm not sure, but calling resize with the border width subtractions
// fixes a glitch where windows would not redraw until they were
// manually resized after restarting dwm.
resize(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw), False);
if (c->bw) {
c->oldbw = c->bw;
c->bw = 0;
resizeclient(c, m->wx, m->wy, m->ww, m->wh);
}
}
}
void
@ -1937,9 +1961,14 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
if (selmon->sel->isfloating) {
if (selmon->sel->bw != borderpx) {
selmon->sel->oldbw = selmon->sel->bw;
selmon->sel->bw = borderpx;
}
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0);
selmon->sel->w - selmon->sel->bw * 2, selmon->sel->h - selmon->sel->bw * 2, 0);
}
arrange(selmon);
}