Applied noborder patch

This commit is contained in:
lhark 2016-11-14 18:32:02 -05:00
parent bb3bd6fec3
commit a3b87b1311

41
dwm.c
View file

@ -395,9 +395,24 @@ arrange(Monitor *m)
void void
arrangemon(Monitor *m) arrangemon(Monitor *m)
{ {
int n = 0;
Client *c;
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); 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); m->lt[m->sellt]->arrange(m);
}
} else {
monocle(m);
}
} }
void void
@ -1111,10 +1126,19 @@ monocle(Monitor *m)
for (c = m->clients; c; c = c->next) for (c = m->clients; c; c = c->next)
if (ISVISIBLE(c)) if (ISVISIBLE(c))
n++; 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); snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) 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); // 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 void
@ -1717,9 +1741,14 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */ if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
return; return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; 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, 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); arrange(selmon);
} }