diff options
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/bar_anybar.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/patch/bar_anybar.c b/patch/bar_anybar.c index fa6b4d2..05546e3 100644 --- a/patch/bar_anybar.c +++ b/patch/bar_anybar.c @@ -3,20 +3,21 @@ managealtbar(Window win, XWindowAttributes *wa) { Monitor *m; Bar *bar; - int i; + int i = 0; if (!(m = recttomon(wa->x, wa->y, wa->width, wa->height))) return; - for (i = 0, bar = m->bar; bar && bar->win && bar->next; bar = bar->next, ++i); // find last bar + for (bar = m->bar; bar && bar->win && bar->next; bar = bar->next); // find last bar if (!bar) { bar = m->bar = ecalloc(1, sizeof(Bar)); bar->topbar = topbar; } else if (bar && bar->win) { + i = bar->idx + 1; bar->next = ecalloc(1, sizeof(Bar)); - #if BAR_ANYBAR_STACK_BARS_PATCH - bar->next->topbar = topbar; - #else + #if BAR_ANYBAR_TOP_AND_BOTTOM_BARS_PATCH bar->next->topbar = !bar->topbar; - #endif // BAR_ANYBAR_STACK_BARS_PATCH + #else + bar->next->topbar = topbar; + #endif // BAR_ANYBAR_TOP_AND_BOTTOM_BARS_PATCH bar = bar->next; } bar->external = 1; @@ -25,12 +26,13 @@ managealtbar(Window win, XWindowAttributes *wa) bar->idx = i; bar->borderpx = 0; bar->win = win; + bar->bw = wa->width; bar->bh = wa->height; updatebarpos(m); arrange(m); XSelectInput(dpy, win, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); XMapWindow(dpy, win); - XMoveResizeWindow(dpy, bar->win, bar->bx, -bar->by, wa->width, bar->bh); + XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh); arrange(selmon); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &win, 1); |
