mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
setborderpx: refactoring patch
This commit is contained in:
parent
93f9d97e84
commit
6a0f5b4250
@ -2,44 +2,55 @@ void
|
|||||||
setborderpx(const Arg *arg)
|
setborderpx(const Arg *arg)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
int prev_borderpx = selmon->borderpx;
|
Monitor *m = selmon;
|
||||||
|
#if BAR_BORDER_PATCH
|
||||||
if (arg->i == 0)
|
Bar *bar;
|
||||||
selmon->borderpx = borderpx;
|
#endif // BAR_BORDER_PATCH
|
||||||
else if (selmon->borderpx + arg->i < 0)
|
int prev_borderpx = m->borderpx;
|
||||||
selmon->borderpx = 0;
|
m->borderpx = arg->i
|
||||||
else
|
? MAX(m->borderpx + arg->i, 0)
|
||||||
selmon->borderpx += arg->i;
|
: m->borderpx == borderpx
|
||||||
|
? 0
|
||||||
|
: borderpx;
|
||||||
|
int delta = 2 * (m->borderpx - prev_borderpx);
|
||||||
|
|
||||||
#if BAR_BORDER_PATCH
|
#if BAR_BORDER_PATCH
|
||||||
for (bar = selmon->bar; bar; bar = bar->next) {
|
for (bar = m->bar; bar; bar = bar->next) {
|
||||||
bar->bh = bar->bh - 2 * bar->borderpx + 2 * selmon->borderpx;
|
bar->bh = bar->bh - 2 * bar->borderpx + 2 * m->borderpx;
|
||||||
bar->borderpx = selmon->borderpx;
|
bar->borderpx = m->borderpx;
|
||||||
}
|
}
|
||||||
updatebarpos(selmon);
|
updatebarpos(m);
|
||||||
for (bar = selmon->bar; bar; bar = bar->next)
|
for (bar = m->bar; bar; bar = bar->next)
|
||||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||||
#endif // BAR_BORDER_PATCH
|
#endif // BAR_BORDER_PATCH
|
||||||
|
|
||||||
for (c = selmon->clients; c; c = c->next)
|
for (c = m->clients; c; c = c->next) {
|
||||||
{
|
c->bw = m->borderpx;
|
||||||
if (c->bw + arg->i < 0)
|
#if !FAKEFULLSCREEN_PATCH
|
||||||
c->bw = 0;
|
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||||
else
|
if (c->isfullscreen && !c->fakefullscreen)
|
||||||
c->bw = selmon->borderpx;
|
continue;
|
||||||
|
#else
|
||||||
|
if (c->isfullscreen)
|
||||||
|
continue;
|
||||||
|
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||||
|
#endif // FAKEFULLSCREEN_PATCH
|
||||||
|
#if BAR_WINTITLEACTIONS_PATCH
|
||||||
|
if (HIDDEN(c))
|
||||||
|
continue;
|
||||||
|
#endif // BAR_WINTITLEACTIONS_PATCH
|
||||||
|
#if SCRATCHPADS_PATCH
|
||||||
|
if ((c->tags & SPTAGMASK) && !ISVISIBLE(c))
|
||||||
|
continue;
|
||||||
|
#endif // SCRATCHPADS_PATCH
|
||||||
|
#if SCRATCHPAD_ALT_1_PATCH
|
||||||
|
if ((c->tags & SCRATCHPAD_MASK))
|
||||||
|
continue;
|
||||||
|
#endif // SCRATCHPAD_ALT_1_PATCH
|
||||||
|
if (!c->isfloating && m->lt[m->sellt]->arrange)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (c->isfloating || !selmon->lt[selmon->sellt]->arrange)
|
resizeclient(c, c->x, c->y, c->w - delta, c->h - delta);
|
||||||
{
|
|
||||||
if (arg->i != 0 && prev_borderpx + arg->i >= 0)
|
|
||||||
resize(c, c->x, c->y, c->w-(arg->i*2), c->h-(arg->i*2), 0);
|
|
||||||
else if (arg->i != 0)
|
|
||||||
resizeclient(c, c->x, c->y, c->w, c->h);
|
|
||||||
else if (prev_borderpx > borderpx)
|
|
||||||
resize(c, c->x, c->y, c->w + 2*(prev_borderpx - borderpx), c->h + 2*(prev_borderpx - borderpx), 0);
|
|
||||||
else if (prev_borderpx < borderpx)
|
|
||||||
resize(c, c->x, c->y, c->w - 2*(borderpx - prev_borderpx), c->h - 2*(borderpx - prev_borderpx), 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
arrange(selmon);
|
arrange(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user