mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
barmodules: refactoring updatebarpos
This commit is contained in:
parent
d7a7ac67ee
commit
ff72f80029
21
dwm.c
21
dwm.c
@ -884,7 +884,6 @@ buttonpress(XEvent *e)
|
||||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
const BarRule *br;
|
||||
BarClickArg carg = { 0, 0, 0, 0 };
|
||||
|
||||
click = ClkRootWin;
|
||||
/* focus monitor if necessary */
|
||||
if ((m = wintomon(ev->window)) && m != selmon
|
||||
@ -3478,23 +3477,25 @@ updatebarpos(Monitor *m)
|
||||
int x_pad = 0;
|
||||
#endif // BAR_PADDING_PATCH
|
||||
|
||||
for (num_bars = 0, bar = m->bar; bar; bar = bar->next, num_bars++);
|
||||
if (m->showbar)
|
||||
if (!m->showbar) {
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
bar->by = -bh - y_pad;
|
||||
return;
|
||||
}
|
||||
|
||||
for (num_bars = 0, bar = m->bar; bar; bar = bar->next, num_bars++)
|
||||
if (bar->topbar)
|
||||
m->wy = m->my + bh + y_pad;
|
||||
m->wh = m->wh - y_pad * num_bars - bh * num_bars;
|
||||
|
||||
for (bar = m->bar; bar; bar = bar->next) {
|
||||
bar->bx = m->mx + x_pad;
|
||||
bar->bw = m->ww - 2 * x_pad;
|
||||
bar->bh = bh;
|
||||
if (m->showbar) {
|
||||
if (bar->topbar) {
|
||||
m->wy = m->wy + bh + y_pad;
|
||||
if (bar->topbar)
|
||||
bar->by = m->wy - bh;
|
||||
} else
|
||||
else
|
||||
bar->by = m->wy + m->wh;
|
||||
} else {
|
||||
bar->by = -bh - y_pad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user