diff --git a/README.md b/README.md index 8ce4b07..3638472 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: +2020-09-09 - Added the bar border patch + 2020-09-08 - Added ipc v1.5.5 patch 2020-09-07 - Scratchpads improvement (multi-monitor support) @@ -202,6 +204,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [awesomebar](https://dwm.suckless.org/patches/awesomebar/) - enhanced taskbar that allows focus / hiding / unhiding of windows by clicking on the status bar + - [bar_border](https://codemadness.org/paste/dwm-border-bar.patch) + - adds a border around the bar similarly to how client windows have borders + - [bar_height](https://dwm.suckless.org/patches/bar_height/) - allows the bar height to be explicitly set rather than being derived from font diff --git a/config.def.h b/config.def.h index 1363b92..d7999f2 100644 --- a/config.def.h +++ b/config.def.h @@ -60,8 +60,10 @@ static const int quit_empty_window_count = 2; /* only allow dwm to quit if no #if BAR_EXTRASTATUS_PATCH static const char statussep = ';'; /* separator between status bars */ #endif // BAR_EXTRASTATUS_PATCH -#if BAR_TABGROUPS_PATCH +#if BAR_TABGROUPS_PATCH && MONOCLE_LAYOUT static void (*bartabmonfns[])(Monitor *) = { monocle /* , customlayoutfn */ }; +#else +static void (*bartabmonfns[])(Monitor *) = { NULL /* , customlayoutfn */ }; #endif // BAR_TABGROUPS_PATCH #if BAR_PANGO_PATCH static const char font[] = "monospace 10"; diff --git a/dwm.c b/dwm.c index 769cd71..50c0703 100644 --- a/dwm.c +++ b/dwm.c @@ -254,34 +254,27 @@ struct Bar { int idx; int showbar; int topbar; + int borderpx; + int borderscheme; int bx, by, bw, bh; /* bar geometry */ int w[BARRULES]; // width, array length == barrules, then use r index for lookup purposes int x[BARRULES]; // x position, array length == ^ }; -typedef struct { - int max_width; -} BarWidthArg; - typedef struct { int x; + int y; + int h; int w; -} BarDrawArg; - -typedef struct { - int rel_x; - int rel_y; - int rel_w; - int rel_h; -} BarClickArg; +} BarArg; typedef struct { int monitor; int bar; int alignment; // see bar alignment enum - int (*widthfunc)(Bar *bar, BarWidthArg *a); - int (*drawfunc)(Bar *bar, BarDrawArg *a); - int (*clickfunc)(Bar *bar, Arg *arg, BarClickArg *a); + int (*widthfunc)(Bar *bar, BarArg *a); + int (*drawfunc)(Bar *bar, BarArg *a); + int (*clickfunc)(Bar *bar, Arg *arg, BarArg *a); char *name; // for debugging int x, w; // position, width for internal use } BarRule; @@ -958,7 +951,7 @@ buttonpress(XEvent *e) Bar *bar; XButtonPressedEvent *ev = &e->xbutton; const BarRule *br; - BarClickArg carg = { 0, 0, 0, 0 }; + BarArg carg = { 0, 0, 0, 0 }; click = ClkRootWin; /* focus monitor if necessary */ if ((m = wintomon(ev->window)) && m != selmon @@ -980,10 +973,10 @@ buttonpress(XEvent *e) if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->index) continue; if (bar->x[r] <= ev->x && ev->x <= bar->x[r] + bar->w[r]) { - carg.rel_x = ev->x - bar->x[r]; - carg.rel_y = ev->y; - carg.rel_w = bar->w[r]; - carg.rel_h = bar->bh; + carg.x = ev->x - bar->x[r]; + carg.y = ev->y - bar->borderpx; + carg.w = bar->w[r]; + carg.h = bar->bh - 2 * bar->borderpx; click = br->clickfunc(bar, &arg, &carg); if (click < 0) return; @@ -1407,6 +1400,12 @@ createmon(void) m->bar = bar; istopbar = !istopbar; bar->showbar = 1; + #if BAR_BORDER_PATCH + bar->borderpx = borderpx; + #else + bar->borderpx = 0; + #endif // BAR_BORDER_PATCH + bar->borderscheme = SchemeNorm; } #if FLEXTILE_DELUXE_LAYOUT @@ -1571,24 +1570,32 @@ drawbarwin(Bar *bar) int r, w, total_drawn = 0; int rx, lx, rw, lw; // bar size, split between left and right if a center module is added const BarRule *br; - BarWidthArg warg = { 0 }; - BarDrawArg darg = { 0, 0 }; - rw = lw = bar->bw; - rx = lx = 0; + if (bar->borderpx) { + XSetForeground(drw->dpy, drw->gc, scheme[bar->borderscheme][ColBorder].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, 0, 0, bar->bw, bar->bh); + } + + BarArg warg = { 0 }; + BarArg darg = { 0 }; + warg.h = bar->bh - 2 * bar->borderpx; + + rw = lw = bar->bw - 2 * bar->borderpx; + rx = lx = bar->borderpx; drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, lx, 0, lw, bh, 1, 1); + drw_rect(drw, lx, bar->borderpx, lw, bar->bh - 2 * bar->borderpx, 1, 1); for (r = 0; r < LENGTH(barrules); r++) { br = &barrules[r]; - if (br->bar != bar->idx || br->drawfunc == NULL || (br->monitor == 'A' && bar->mon != selmon)) + if (br->bar != bar->idx || (br->monitor == 'A' && bar->mon != selmon)) continue; if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->index) continue; drw_setscheme(drw, scheme[SchemeNorm]); - warg.max_width = (br->alignment < BAR_ALIGN_RIGHT_LEFT ? lw : rw); + warg.w = (br->alignment < BAR_ALIGN_RIGHT_LEFT ? lw : rw); + w = br->widthfunc(bar, &warg); - w = MIN(warg.max_width, w); + w = MIN(warg.w, w); if (lw <= 0) { // if left is exhausted then switch to right side, and vice versa lw = rw; @@ -1653,9 +1660,13 @@ drawbarwin(Bar *bar) } bar->w[r] = w; darg.x = bar->x[r]; + darg.y = bar->borderpx; + darg.h = bar->bh - 2 * bar->borderpx; darg.w = bar->w[r]; - total_drawn += br->drawfunc(bar, &darg); + if (br->drawfunc) + total_drawn += br->drawfunc(bar, &darg); } + if (total_drawn == 0 && bar->showbar) { bar->showbar = 0; updatebarpos(bar->mon); @@ -2899,12 +2910,12 @@ setfullscreen(Client *c, int fullscreen) PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); c->isfullscreen = 1; #if !FAKEFULLSCREEN_PATCH + c->oldbw = c->bw; #if FAKEFULLSCREEN_CLIENT_PATCH if (c->fakefullscreen == 1) return; #endif // FAKEFULLSCREEN_CLIENT_PATCH c->oldstate = c->isfloating; - c->oldbw = c->bw; c->bw = 0; c->isfloating = 1; resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); @@ -2915,6 +2926,7 @@ setfullscreen(Client *c, int fullscreen) PropModeReplace, (unsigned char*)0, 0); c->isfullscreen = 0; #if !FAKEFULLSCREEN_PATCH + c->bw = c->oldbw; #if FAKEFULLSCREEN_CLIENT_PATCH if (c->fakefullscreen == 1) return; @@ -2922,7 +2934,6 @@ setfullscreen(Client *c, int fullscreen) c->fakefullscreen = 1; #endif // FAKEFULLSCREEN_CLIENT_PATCH c->isfloating = c->oldstate; - c->bw = c->oldbw; c->x = c->oldx; c->y = c->oldy; c->w = c->oldw; @@ -3197,7 +3208,7 @@ showhide(Client *c) if (!c) return; if (ISVISIBLE(c)) { - #if SCRATCHPADS_KEEP_POSITION_AND_SIZE_PATCH + #if SCRATCHPADS_PATCH && SCRATCHPADS_KEEP_POSITION_AND_SIZE_PATCH if ( (c->tags & SPTAGMASK) && c->isfloating && @@ -3733,7 +3744,6 @@ updatebarpos(Monitor *m) m->wy = m->my; m->ww = m->mw; m->wh = m->mh; - int num_bars; Bar *bar; #if BAR_PADDING_PATCH int y_pad = vertpad; @@ -3755,24 +3765,23 @@ updatebarpos(Monitor *m) for (bar = m->bar; bar; bar = bar->next) { bar->bx = m->wx + x_pad; bar->bw = m->ww - 2 * x_pad; - bar->bh = bh; + bar->bh = bh + bar->borderpx * 2; } for (bar = m->bar; bar; bar = bar->next) if (!m->showbar || !bar->showbar) - bar->by = -bh - y_pad; + bar->by = -bh - bar->borderpx * 2 - y_pad; if (!m->showbar) return; - for (num_bars = 0, bar = m->bar; bar; bar = bar->next) { + for (bar = m->bar; bar; bar = bar->next) { if (!bar->showbar) continue; if (bar->topbar) - m->wy = m->wy + bh + y_pad; - num_bars++; + m->wy = m->wy + bh + bar->borderpx * 2 + y_pad; + m->wh -= y_pad + bh + bar->borderpx * 2; } - m->wh = m->wh - y_pad * num_bars - bh * num_bars; for (bar = m->bar; bar; bar = bar->next) - bar->by = (bar->topbar ? m->wy - bh : m->wy + m->wh); + bar->by = (bar->topbar ? m->wy - bh - bar->borderpx * 2 : m->wy + m->wh); } void diff --git a/patch/bar_awesomebar.c b/patch/bar_awesomebar.c index 4bf537e..47b9eee 100644 --- a/patch/bar_awesomebar.c +++ b/patch/bar_awesomebar.c @@ -1,11 +1,11 @@ int -width_awesomebar(Bar *bar, BarWidthArg *a) +width_awesomebar(Bar *bar, BarArg *a) { - return a->max_width; + return a->w; } int -draw_awesomebar(Bar *bar, BarDrawArg *a) +draw_awesomebar(Bar *bar, BarArg *a) { int n = 0, scm, remainder = 0, tabw, pad; unsigned int i; @@ -44,9 +44,9 @@ draw_awesomebar(Bar *bar, BarDrawArg *a) #endif // BAR_CENTEREDWINDOWNAME_PATCH drw_setscheme(drw, scheme[scm]); - drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, pad, c->name, 0, False); + drw_text(drw, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, pad, c->name, 0, False); if (c->isfloating) - drawindicator(c->mon, c, 1, x, w, 0, 0, c->isfixed, floatindicatortype); + drawindicator(c->mon, c, 1, x, a->y, w, a->h, 0, 0, c->isfixed, floatindicatortype); x += tabw + (i < remainder ? 1 : 0); } } @@ -54,7 +54,7 @@ draw_awesomebar(Bar *bar, BarDrawArg *a) } int -click_awesomebar(Bar *bar, Arg *arg, BarClickArg *a) +click_awesomebar(Bar *bar, Arg *arg, BarArg *a) { int x = 0, n = 0; Client *c; @@ -69,8 +69,8 @@ click_awesomebar(Bar *bar, Arg *arg, BarClickArg *a) if (!c || !ISVISIBLE(c)) continue; else - x += (1.0 / (double)n) * a->rel_w; - } while (c && a->rel_x > x && (c = c->next)); + x += (1.0 / (double)n) * a->w; + } while (c && a->x > x && (c = c->next)); if (c) { arg->v = c; diff --git a/patch/bar_awesomebar.h b/patch/bar_awesomebar.h index 3269954..25bd98f 100644 --- a/patch/bar_awesomebar.h +++ b/patch/bar_awesomebar.h @@ -1,3 +1,3 @@ -static int width_awesomebar(Bar *bar, BarWidthArg *a); -static int draw_awesomebar(Bar *bar, BarDrawArg *a); -static int click_awesomebar(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file +static int width_awesomebar(Bar *bar, BarArg *a); +static int draw_awesomebar(Bar *bar, BarArg *a); +static int click_awesomebar(Bar *bar, Arg *arg, BarArg *a); \ No newline at end of file diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c index 8bc5ff1..2b5ce72 100644 --- a/patch/bar_fancybar.c +++ b/patch/bar_fancybar.c @@ -1,11 +1,11 @@ int -width_fancybar(Bar *bar, BarWidthArg *a) +width_fancybar(Bar *bar, BarArg *a) { - return a->max_width; + return a->w; } int -draw_fancybar(Bar *bar, BarDrawArg *a) +draw_fancybar(Bar *bar, BarArg *a) { int ftw, mw, ew = 0, n = 0; unsigned int i; @@ -52,9 +52,9 @@ draw_fancybar(Bar *bar, BarDrawArg *a) ftw = MIN(m->sel == c ? w : mw, TEXTW(c->name)); drw_setscheme(drw, scheme[m->sel == c ? SchemeTitleSel : SchemeTitleNorm]); if (ftw > 0) /* trap special handling of 0 in drw_text */ - drw_text(drw, x, 0, ftw, bh, lrpad / 2, c->name, 0, False); + drw_text(drw, x, a->y, ftw, a->h, lrpad / 2, c->name, 0, False); if (c->isfloating) - drawindicator(c->mon, c, 1, x, w, 0, 0, c->isfixed, floatindicatortype); + drawindicator(c->mon, c, 1, x, a->y, w, a->h, 0, 0, c->isfixed, floatindicatortype); x += ftw; w -= ftw; } @@ -63,7 +63,7 @@ draw_fancybar(Bar *bar, BarDrawArg *a) } int -click_fancybar(Bar *bar, Arg *arg, BarClickArg *a) +click_fancybar(Bar *bar, Arg *arg, BarArg *a) { return ClkWinTitle; } diff --git a/patch/bar_fancybar.h b/patch/bar_fancybar.h index c90d189..b4f8174 100644 --- a/patch/bar_fancybar.h +++ b/patch/bar_fancybar.h @@ -1,3 +1,3 @@ -static int width_fancybar(Bar *bar, BarWidthArg *a); -static int draw_fancybar(Bar *bar, BarDrawArg *a); -static int click_fancybar(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file +static int width_fancybar(Bar *bar, BarArg *a); +static int draw_fancybar(Bar *bar, BarArg *a); +static int click_fancybar(Bar *bar, Arg *arg, BarArg *a); \ No newline at end of file diff --git a/patch/bar_flexwintitle.c b/patch/bar_flexwintitle.c index 216c802..2c46b0e 100644 --- a/patch/bar_flexwintitle.c +++ b/patch/bar_flexwintitle.c @@ -23,28 +23,28 @@ enum { GRP_NOSELECTION, GRP_MASTER, GRP_STACK1, GRP_STACK2, GRP_FLOAT, GRP_HIDDEN }; int -width_flexwintitle(Bar *bar, BarWidthArg *a) +width_flexwintitle(Bar *bar, BarArg *a) { - return a->max_width; + return a->w; } int -draw_flexwintitle(Bar *bar, BarDrawArg *a) +draw_flexwintitle(Bar *bar, BarArg *a) { - drw_rect(drw, a->x, 0, a->w, bh, 1, 1); - return flextitlecalculate(bar->mon, a->x, a->w, -1, flextitledraw, NULL); + drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1); + return flextitlecalculate(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a); } int -click_flexwintitle(Bar *bar, Arg *arg, BarClickArg *a) +click_flexwintitle(Bar *bar, Arg *arg, BarArg *a) { - flextitlecalculate(bar->mon, 0, a->rel_w, a->rel_x, flextitleclick, arg); + flextitlecalculate(bar->mon, 0, a->w, a->x, flextitleclick, arg, a); return ClkWinTitle; } Client * flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int scheme, int draw_tiled, int draw_hidden, int draw_floating, - int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg) + int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg) { int i; for (i = 0; c && i < max_clients; c = c->next) { @@ -56,7 +56,7 @@ flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, i (draw_hidden && HIDDEN(c)) ) ) { - tabfn(m, c, passx, x, w + (i < r ? 1 : 0), scheme, arg); + tabfn(m, c, passx, x, w + (i < r ? 1 : 0), scheme, arg, barg); x += w + (i < r ? 1 : 0); i++; } @@ -166,7 +166,7 @@ getselschemefor(int scheme) } void -flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Arg *arg) +flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Arg *arg, BarArg *barg) { if (!c) return; @@ -189,14 +189,14 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar pad = (w - TEXTW(c->name) + lrpad) / 2; #endif // BAR_CENTEREDWINDOWNAME_PATCH - drw_text(drw, x, 0, w, bh, pad, c->name, 0, False); + drw_text(drw, x, barg->y, w, barg->h, pad, c->name, 0, False); if (c->isfloating) - drawindicator(m, c, 1, x + 2, w, 0, 0, 0, floatindicatortype); + drawindicator(m, c, 1, x + 2, barg->y, w, barg->h, 0, 0, 0, floatindicatortype); if (FLEXWINTITLE_BORDERS) { XSetForeground(drw->dpy, drw->gc, scheme[SchemeSel][ColBorder].pixel); - XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, 0, 1, bh); - XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w, 0, 1, bh); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, barg->y, 1, barg->h); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= barg->w ? 1 : 0), barg->y, 1, barg->h); } /* Optional tags icons */ for (i = 0; i < NUMTAGS; i++) { @@ -207,7 +207,7 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar } if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1) - drawindicator(m, c, 1, x, w, 0, 0, 0, INDICATOR_RIGHT_TAGS); + drawindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, 0, INDICATOR_RIGHT_TAGS); } #ifndef HIDDEN @@ -215,7 +215,7 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar #endif void -flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg) +flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg) { if (passx >= x && passx <= x + w) arg->v = c; @@ -224,7 +224,8 @@ flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg * int flextitlecalculate( Monitor *m, int offx, int tabw, int passx, - void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), + Arg *arg, BarArg *barg ) { Client *c; int n, center = 0, mirror = 0, fixed = 0; // layout configuration @@ -355,13 +356,13 @@ flextitlecalculate( den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden; w = num / den; r = num % den; // rest - c = flextitledrawarea(m, c, mas_x, r, w, den, !m->lt[m->sellt]->arrange ? SchemeFlexActFloat : SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, FLEXWINTITLE_FLOATWEIGHT, passx, tabfn, arg); // floating + c = flextitledrawarea(m, c, mas_x, r, w, den, !m->lt[m->sellt]->arrange ? SchemeFlexActFloat : SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, FLEXWINTITLE_FLOATWEIGHT, passx, tabfn, arg, barg); // floating /* no master and stack mode, e.g. monocole, grid layouts, fibonacci */ } else if (fulllayout) { den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnhidden; w = num / den; r = num % den; // rest - c = flextitledrawarea(m, c, mas_x, r, w, den, SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, 0, passx, tabfn, arg); // full + c = flextitledrawarea(m, c, mas_x, r, w, den, SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, 0, passx, tabfn, arg, barg); // full /* tiled mode */ } else { den = clientsnmaster * FLEXWINTITLE_MASTERWEIGHT + (clientsnstack + clientsnstack2) * FLEXWINTITLE_STACKWEIGHT + clientsnfloating * FLEXWINTITLE_FLOATWEIGHT + clientsnhidden * FLEXWINTITLE_HIDDENWEIGHT; @@ -420,17 +421,17 @@ flextitlecalculate( } flt_x = hid_x + hid_w; - c = flextitledrawarea(m, c, mas_x, rr, w * FLEXWINTITLE_MASTERWEIGHT + rw, clientsnmaster, SCHEMEFOR(GRP_MASTER), 1, 0, 0, passx, tabfn, arg); // master + c = flextitledrawarea(m, c, mas_x, rr, w * FLEXWINTITLE_MASTERWEIGHT + rw, clientsnmaster, SCHEMEFOR(GRP_MASTER), 1, 0, 0, passx, tabfn, arg, barg); // master rr -= clientsnmaster; - c = flextitledrawarea(m, c, st1_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack, SCHEMEFOR(GRP_STACK1), 1, 0, 0, passx, tabfn, arg); // stack1 + c = flextitledrawarea(m, c, st1_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack, SCHEMEFOR(GRP_STACK1), 1, 0, 0, passx, tabfn, arg, barg); // stack1 rr -= clientsnstack; if (clientsnstack2) { - c = flextitledrawarea(m, c, st2_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack2, SCHEMEFOR(GRP_STACK2), 1, 0, 0, passx, tabfn, arg); // stack2 + c = flextitledrawarea(m, c, st2_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack2, SCHEMEFOR(GRP_STACK2), 1, 0, 0, passx, tabfn, arg, barg); // stack2 rr -= clientsnstack2; } - c = flextitledrawarea(m, m->clients, hid_x, rr, w * FLEXWINTITLE_HIDDENWEIGHT + rw, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg); // hidden + c = flextitledrawarea(m, m->clients, hid_x, rr, w * FLEXWINTITLE_HIDDENWEIGHT + rw, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg, barg); // hidden rr -= clientsnhidden; - c = flextitledrawarea(m, m->clients, flt_x, rr, w * FLEXWINTITLE_FLOATWEIGHT + rw, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg); // floating + c = flextitledrawarea(m, m->clients, flt_x, rr, w * FLEXWINTITLE_FLOATWEIGHT + rw, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg, barg); // floating } return 1; } \ No newline at end of file diff --git a/patch/bar_flexwintitle.h b/patch/bar_flexwintitle.h index be7b675..6183c8e 100644 --- a/patch/bar_flexwintitle.h +++ b/patch/bar_flexwintitle.h @@ -1,10 +1,10 @@ -static int width_flexwintitle(Bar *bar, BarWidthArg *a); -static int draw_flexwintitle(Bar *bar, BarDrawArg *a); -static int click_flexwintitle(Bar *bar, Arg *arg, BarClickArg *a); +static int width_flexwintitle(Bar *bar, BarArg *a); +static int draw_flexwintitle(Bar *bar, BarArg *a); +static int click_flexwintitle(Bar *bar, Arg *arg, BarArg *a); -static void flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg); -static void flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg); -static int flextitlecalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); +static void flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg); +static void flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg); +static int flextitlecalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg); static int getschemefor(Monitor *m, int group, int activegroup); static int getselschemefor(int scheme); -static Client *flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int tabscheme, int draw_tiled, int draw_hidden, int draw_floating, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); \ No newline at end of file +static Client *flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int tabscheme, int draw_tiled, int draw_hidden, int draw_floating, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg); \ No newline at end of file diff --git a/patch/bar_indicators.c b/patch/bar_indicators.c index 11876c6..624aff7 100644 --- a/patch/bar_indicators.c +++ b/patch/bar_indicators.c @@ -10,7 +10,7 @@ #endif void -drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned int tag, int filled, int invert, int type) +drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert, int type) { int i, boxw, boxs, indn = 0; if (!(occ & 1 << tag) || type == INDICATOR_NONE) @@ -24,31 +24,31 @@ drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned in switch (type) { default: case INDICATOR_TOP_LEFT_SQUARE: - drw_rect(drw, x + boxs, boxs, boxw, boxw, filled, invert); + drw_rect(drw, x + boxs, y + boxs, boxw, boxw, filled, invert); break; case INDICATOR_TOP_LEFT_LARGER_SQUARE: - drw_rect(drw, x + boxs + 2, boxs+1, boxw+1, boxw+1, filled, invert); + drw_rect(drw, x + boxs + 2, y + boxs+1, boxw+1, boxw+1, filled, invert); break; case INDICATOR_TOP_BAR: - drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw/2, filled, invert); + drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), boxw/2, filled, invert); break; case INDICATOR_TOP_BAR_SLIM: - drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), 1, 0, invert); + drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), 1, 0, invert); break; case INDICATOR_BOTTOM_BAR: - drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, filled, invert); + drw_rect(drw, x + boxw, y + h - boxw/2, w - ( 2 * boxw + 1), boxw/2, filled, invert); break; case INDICATOR_BOTTOM_BAR_SLIM: - drw_rect(drw, x + boxw, bh - 1, w - ( 2 * boxw + 1), 1, 0, invert); + drw_rect(drw, x + boxw, y + h - 1, w - ( 2 * boxw + 1), 1, 0, invert); break; case INDICATOR_BOX: - drw_rect(drw, x + boxw, 0, w - 2 * boxw, bh, 0, invert); + drw_rect(drw, x + boxw, y, w - 2 * boxw, h, 0, invert); break; case INDICATOR_BOX_WIDER: - drw_rect(drw, x + boxw/2, 0, w - boxw, bh, 0, invert); + drw_rect(drw, x + boxw/2, y, w - boxw, h, 0, invert); break; case INDICATOR_BOX_FULL: - drw_rect(drw, x, 0, w - 2, bh, 0, invert); + drw_rect(drw, x, y, w - 2, h, 0, invert); break; case INDICATOR_CLIENT_DOTS: for (c = m->clients; c; c = c->next) { @@ -56,7 +56,7 @@ drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned in drw_rect(drw, x, 1 + (indn * 2), m->sel == c ? 6 : 1, 1, 1, invert); indn++; } - if (bh <= 1 + (indn * 2)) { + if (h <= 1 + (indn * 2)) { indn = 0; x += 2; } diff --git a/patch/bar_indicators.h b/patch/bar_indicators.h index 505d49e..1364cc3 100644 --- a/patch/bar_indicators.h +++ b/patch/bar_indicators.h @@ -13,4 +13,4 @@ enum { INDICATOR_RIGHT_TAGS }; -static void drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned int tag, int filled, int invert, int type); \ No newline at end of file +static void drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert, int type); \ No newline at end of file diff --git a/patch/bar_ltsymbol.c b/patch/bar_ltsymbol.c index c600f5c..4c861f8 100644 --- a/patch/bar_ltsymbol.c +++ b/patch/bar_ltsymbol.c @@ -1,17 +1,17 @@ int -width_ltsymbol(Bar *bar, BarWidthArg *a) +width_ltsymbol(Bar *bar, BarArg *a) { return TEXTW(bar->mon->ltsymbol); } int -draw_ltsymbol(Bar *bar, BarDrawArg *a) +draw_ltsymbol(Bar *bar, BarArg *a) { - return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, bar->mon->ltsymbol, 0, False); + return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, bar->mon->ltsymbol, 0, False); } int -click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a) +click_ltsymbol(Bar *bar, Arg *arg, BarArg *a) { return ClkLtSymbol; } \ No newline at end of file diff --git a/patch/bar_ltsymbol.h b/patch/bar_ltsymbol.h index d9c79bf..4188584 100644 --- a/patch/bar_ltsymbol.h +++ b/patch/bar_ltsymbol.h @@ -1,3 +1,3 @@ -static int width_ltsymbol(Bar *bar, BarWidthArg *a); -static int draw_ltsymbol(Bar *bar, BarDrawArg *a); -static int click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a); +static int width_ltsymbol(Bar *bar, BarArg *a); +static int draw_ltsymbol(Bar *bar, BarArg *a); +static int click_ltsymbol(Bar *bar, Arg *arg, BarArg *a); diff --git a/patch/bar_powerline_status.c b/patch/bar_powerline_status.c index 03847d6..2f95570 100644 --- a/patch/bar_powerline_status.c +++ b/patch/bar_powerline_status.c @@ -1,7 +1,7 @@ static Clr **statusscheme; int -width_pwrl_status(Bar *bar, BarWidthArg *a) +width_pwrl_status(Bar *bar, BarArg *a) { #if BAR_STATUSCMD_PATCH return widthpowerlinestatus(rawstext); @@ -12,7 +12,7 @@ width_pwrl_status(Bar *bar, BarWidthArg *a) #if BAR_EXTRASTATUS_PATCH int -width_pwrl_status_es(Bar *bar, BarWidthArg *a) +width_pwrl_status_es(Bar *bar, BarArg *a) { #if BAR_STATUSCMD_PATCH return widthpowerlinestatus(rawestext); @@ -23,29 +23,29 @@ width_pwrl_status_es(Bar *bar, BarWidthArg *a) #endif // BAR_EXTRASTATUS_PATCH int -draw_pwrl_status(Bar *bar, BarDrawArg *a) +draw_pwrl_status(Bar *bar, BarArg *a) { #if BAR_STATUSCMD_PATCH - return drawpowerlinestatus(a->x + a->w, rawstext); + return drawpowerlinestatus(a->x + a->w, rawstext, a); #else - return drawpowerlinestatus(a->x + a->w, stext); + return drawpowerlinestatus(a->x + a->w, stext, a); #endif // BAR_STATUSCMD_PATCH } #if BAR_EXTRASTATUS_PATCH int -draw_pwrl_status_es(Bar *bar, BarDrawArg *a) +draw_pwrl_status_es(Bar *bar, BarArg *a) { #if BAR_STATUSCMD_PATCH - return drawpowerlinestatus(a->x + a->w, rawestext); + return drawpowerlinestatus(a->x + a->w, rawestext, a); #else - return drawpowerlinestatus(a->x + a->w, estext); + return drawpowerlinestatus(a->x + a->w, estext, a); #endif // BAR_STATUSCMD_PATCH } #endif // BAR_EXTRASTATUS_PATCH int -click_pwrl_status(Bar *bar, Arg *arg, BarClickArg *a) +click_pwrl_status(Bar *bar, Arg *arg, BarArg *a) { return ClkStatusText; } @@ -75,7 +75,7 @@ widthpowerlinestatus(char *stext) } int -drawpowerlinestatus(int xpos, char *stext) +drawpowerlinestatus(int xpos, char *stext, BarArg *barg) { char status[512]; int i, n = strlen(stext), cn = 0; @@ -96,13 +96,13 @@ drawpowerlinestatus(int xpos, char *stext) } if (bp != '|') { - drw_arrow(drw, x - plw, 0, plw, bh, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1); + drw_arrow(drw, x - plw, barg->y, plw, barg->h, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1); x -= plw; } drw_setscheme(drw, nxtscheme); w = TEXTW(bs+2); - drw_text(drw, x - w, 0, w, bh, lrpad / 2, bs+2, 0, False); + drw_text(drw, x - w, barg->y, w, barg->h, lrpad / 2, bs+2, 0, False); x -= w; bp = *bs; @@ -112,8 +112,8 @@ drawpowerlinestatus(int xpos, char *stext) } if (bp != '|') { drw_settrans(drw, prevscheme, scheme[SchemeNorm]); - drw_arrow(drw, x - plw, 0, plw, bh, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1); - drw_rect(drw, x - 2 * plw, 0, plw, bh, 1, 1); + drw_arrow(drw, x - plw, barg->y, plw, barg->h, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1); + drw_rect(drw, x - 2 * plw, barg->y, plw, barg->h, 1, 1); x -= plw * 2; } diff --git a/patch/bar_powerline_status.h b/patch/bar_powerline_status.h index 2ff5ad2..1eb6824 100644 --- a/patch/bar_powerline_status.h +++ b/patch/bar_powerline_status.h @@ -1,11 +1,11 @@ -static int width_pwrl_status(Bar *bar, BarWidthArg *a); +static int width_pwrl_status(Bar *bar, BarArg *a); #if BAR_EXTRASTATUS_PATCH -static int width_pwrl_status_es(Bar *bar, BarWidthArg *a); +static int width_pwrl_status_es(Bar *bar, BarArg *a); #endif // BAR_EXTRASTATUS_PATCH -static int draw_pwrl_status(Bar *bar, BarDrawArg *a); +static int draw_pwrl_status(Bar *bar, BarArg *a); #if BAR_EXTRASTATUS_PATCH -static int draw_pwrl_status_es(Bar *bar, BarDrawArg *a); +static int draw_pwrl_status_es(Bar *bar, BarArg *a); #endif // BAR_EXTRASTATUS_PATCH -static int click_pwrl_status(Bar *bar, Arg *arg, BarClickArg *a); -static int drawpowerlinestatus(int x, char *stext); +static int click_pwrl_status(Bar *bar, Arg *arg, BarArg *a); +static int drawpowerlinestatus(int x, char *stext, BarArg *a); static int widthpowerlinestatus(char *stext); \ No newline at end of file diff --git a/patch/bar_powerline_tags.c b/patch/bar_powerline_tags.c index 44acf15..b91817a 100644 --- a/patch/bar_powerline_tags.c +++ b/patch/bar_powerline_tags.c @@ -1,5 +1,5 @@ int -width_pwrl_tags(Bar *bar, BarWidthArg *a) +width_pwrl_tags(Bar *bar, BarArg *a) { int w, i; int plw = drw->fonts->h / 2 + 1; @@ -21,7 +21,7 @@ width_pwrl_tags(Bar *bar, BarWidthArg *a) } int -draw_pwrl_tags(Bar *bar, BarDrawArg *a) +draw_pwrl_tags(Bar *bar, BarArg *a) { int x, w; int invert; @@ -54,14 +54,14 @@ draw_pwrl_tags(Bar *bar, BarDrawArg *a) w = TEXTW(icon); drw_settrans(drw, prevscheme, (nxtscheme = scheme[bar->mon->tagset[bar->mon->seltags] & 1 << i ? SchemeSel : SchemeNorm])); #if BAR_POWERLINE_TAGS_SLASH_PATCH - drw_arrow(drw, x, 0, plw, bh, 1, 1); + drw_arrow(drw, x, a->y, plw, a->h, 1, 1); #else - drw_arrow(drw, x, 0, plw, bh, 1, 0); + drw_arrow(drw, x, a->y, plw, a->h, 1, 0); #endif // BAR_POWERLINE_TAGS_SLASH_PATCH x += plw; drw_setscheme(drw, nxtscheme); - drw_text(drw, x, 0, w, bh, lrpad / 2, icon, invert, False); - drawindicator(bar->mon, NULL, occ, x, w, i, -1, invert, tagindicatortype); + drw_text(drw, x, a->y, w, a->h, lrpad / 2, icon, invert, False); + drawindicator(bar->mon, NULL, occ, x, a->y, w, a->h, i, -1, invert, tagindicatortype); x += w; prevscheme = nxtscheme; } @@ -69,15 +69,15 @@ draw_pwrl_tags(Bar *bar, BarDrawArg *a) drw_settrans(drw, prevscheme, nxtscheme); #if BAR_POWERLINE_TAGS_SLASH_PATCH - drw_arrow(drw, x, 0, plw, bh, 1, 1); + drw_arrow(drw, x, a->y, plw, a->h, 1, 1); #else - drw_arrow(drw, x, 0, plw, bh, 1, 0); + drw_arrow(drw, x, a->y, plw, a->h, 1, 0); #endif // BAR_POWERLINE_TAGS_SLASH_PATCH return 1; } int -click_pwrl_tags(Bar *bar, Arg *arg, BarClickArg *a) +click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a) { int i = 0, x = lrpad / 2; int plw = drw->fonts->h / 2 + 1; @@ -94,7 +94,7 @@ click_pwrl_tags(Bar *bar, Arg *arg, BarClickArg *a) continue; #endif // BAR_HIDEVACANTTAGS_PATCH x += TEXTW(tagicon(bar->mon, i)) + plw; - } while (a->rel_x >= x && ++i < NUMTAGS); + } while (a->x >= x && ++i < NUMTAGS); if (i < NUMTAGS) { arg->ui = 1 << i; } diff --git a/patch/bar_powerline_tags.h b/patch/bar_powerline_tags.h index b1e0389..f942ff1 100644 --- a/patch/bar_powerline_tags.h +++ b/patch/bar_powerline_tags.h @@ -1,3 +1,3 @@ -static int width_pwrl_tags(Bar *bar, BarWidthArg *a); -static int draw_pwrl_tags(Bar *bar, BarDrawArg *a); -static int click_pwrl_tags(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file +static int width_pwrl_tags(Bar *bar, BarArg *a); +static int draw_pwrl_tags(Bar *bar, BarArg *a); +static int click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a); \ No newline at end of file diff --git a/patch/bar_status.c b/patch/bar_status.c index 756c97a..d37424d 100644 --- a/patch/bar_status.c +++ b/patch/bar_status.c @@ -1,33 +1,33 @@ int -width_status(Bar *bar, BarWidthArg *a) +width_status(Bar *bar, BarArg *a) { return TEXTWM(stext); } #if BAR_EXTRASTATUS_PATCH int -width_status_es(Bar *bar, BarWidthArg *a) +width_status_es(Bar *bar, BarArg *a) { return TEXTWM(estext) - lrpad; } #endif // BAR_EXTRASTATUS_PATCH int -draw_status(Bar *bar, BarDrawArg *a) +draw_status(Bar *bar, BarArg *a) { - return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0, True); + return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, stext, 0, True); } #if BAR_EXTRASTATUS_PATCH int -draw_status_es(Bar *bar, BarDrawArg *a) +draw_status_es(Bar *bar, BarArg *a) { - return drw_text(drw, a->x, 0, a->w, bh, 0, estext, 0, True); + return drw_text(drw, a->x, a->y, a->w, a->h, 0, estext, 0, True); } #endif // BAR_EXTRASTATUS_PATCH int -click_status(Bar *bar, Arg *arg, BarClickArg *a) +click_status(Bar *bar, Arg *arg, BarArg *a) { return ClkStatusText; } diff --git a/patch/bar_status.h b/patch/bar_status.h index 36fabbb..e6d8ab0 100644 --- a/patch/bar_status.h +++ b/patch/bar_status.h @@ -1,9 +1,9 @@ -static int width_status(Bar *bar, BarWidthArg *a); +static int width_status(Bar *bar, BarArg *a); #if BAR_EXTRASTATUS_PATCH -static int width_status_es(Bar *bar, BarWidthArg *a); +static int width_status_es(Bar *bar, BarArg *a); #endif // BAR_EXTRASTATUS_PATCH -static int draw_status(Bar *bar, BarDrawArg *a); +static int draw_status(Bar *bar, BarArg *a); #if BAR_EXTRASTATUS_PATCH -static int draw_status_es(Bar *bar, BarDrawArg *a); +static int draw_status_es(Bar *bar, BarArg *a); #endif // BAR_EXTRASTATUS_PATCH -static int click_status(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file +static int click_status(Bar *bar, Arg *arg, BarArg *a); \ No newline at end of file diff --git a/patch/bar_status2d.c b/patch/bar_status2d.c index 2e413c8..54e008d 100644 --- a/patch/bar_status2d.c +++ b/patch/bar_status2d.c @@ -22,7 +22,7 @@ static char *termcolor[] = { #endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH int -width_status2d(Bar *bar, BarWidthArg *a) +width_status2d(Bar *bar, BarArg *a) { int width; #if BAR_EXTRASTATUS_PATCH || BAR_STATUSCMD_PATCH @@ -35,7 +35,7 @@ width_status2d(Bar *bar, BarWidthArg *a) #if BAR_EXTRASTATUS_PATCH int -width_status2d_es(Bar *bar, BarWidthArg *a) +width_status2d_es(Bar *bar, BarArg *a) { int width; #if BAR_STATUSCMD_PATCH @@ -48,39 +48,41 @@ width_status2d_es(Bar *bar, BarWidthArg *a) #endif // BAR_EXTRASTATUS_PATCH int -draw_status2d(Bar *bar, BarDrawArg *a) +draw_status2d(Bar *bar, BarArg *a) { #if BAR_EXTRASTATUS_PATCH || BAR_STATUSCMD_PATCH - return drawstatusbar(a->x, rawstext); + return drawstatusbar(a, rawstext); #else - return drawstatusbar(a->x, stext); + return drawstatusbar(a, stext); #endif // #if BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH } #if BAR_EXTRASTATUS_PATCH int -draw_status2d_es(Bar *bar, BarDrawArg *a) +draw_status2d_es(Bar *bar, BarArg *a) { #if BAR_STATUSCMD_PATCH - return drawstatusbar(a->x, rawestext); + return drawstatusbar(a, rawestext); #else - return drawstatusbar(a->x, estext); + return drawstatusbar(a, estext); #endif // BAR_STATUSCMD_PATCH } #endif // BAR_EXTRASTATUS_PATCH #if !BAR_STATUSCMD_PATCH int -click_status2d(Bar *bar, Arg *arg, BarClickArg *a) +click_status2d(Bar *bar, Arg *arg, BarArg *a) { return ClkStatusText; } #endif // BAR_STATUSCMD_PATCH int -drawstatusbar(int x, char* stext) +drawstatusbar(BarArg *a, char* stext) { int i, w, len; + int x = a->x; + int y = a->y; short isCode = 0; char *text; char *p; @@ -108,7 +110,7 @@ drawstatusbar(int x, char* stext) text[i] = '\0'; w = TEXTWM(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0, True); + drw_text(drw, x, y, w, bh, 0, text, 0, True); x += w; @@ -194,7 +196,7 @@ drawstatusbar(int x, char* stext) if (rx < 0) rx = 0; - drw_rect(drw, rx + x, ry, rw, rh, 1, 0); + drw_rect(drw, rx + x, y + ry, rw, rh, 1, 0); } else if (text[i] == 'f') { x += atoi(text + ++i); } @@ -207,7 +209,7 @@ drawstatusbar(int x, char* stext) } if (!isCode) { w = TEXTWM(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0, True); + drw_text(drw, x, y, w, bh, 0, text, 0, True); x += w; } free(p); diff --git a/patch/bar_status2d.h b/patch/bar_status2d.h index ea48dd3..868a568 100644 --- a/patch/bar_status2d.h +++ b/patch/bar_status2d.h @@ -1,13 +1,13 @@ -static int width_status2d(Bar *bar, BarWidthArg *a); +static int width_status2d(Bar *bar, BarArg *a); #if BAR_EXTRASTATUS_PATCH -static int width_status2d_es(Bar *bar, BarWidthArg *a); +static int width_status2d_es(Bar *bar, BarArg *a); #endif // BAR_EXTRASTATUS_PATCH -static int draw_status2d(Bar *bar, BarDrawArg *a); +static int draw_status2d(Bar *bar, BarArg *a); #if BAR_EXTRASTATUS_PATCH -static int draw_status2d_es(Bar *bar, BarDrawArg *a); +static int draw_status2d_es(Bar *bar, BarArg *a); #endif // BAR_EXTRASTATUS_PATCH #if !BAR_STATUSCMD_PATCH -static int click_status2d(Bar *bar, Arg *arg, BarClickArg *a); +static int click_status2d(Bar *bar, Arg *arg, BarArg *a); #endif // BAR_STATUSCMD_PATCH -static int drawstatusbar(int x, char *text); +static int drawstatusbar(BarArg *a, char *text); static int status2dtextlength(char *stext); \ No newline at end of file diff --git a/patch/bar_statusbutton.c b/patch/bar_statusbutton.c index 292b83e..7f52af4 100644 --- a/patch/bar_statusbutton.c +++ b/patch/bar_statusbutton.c @@ -1,17 +1,17 @@ int -width_stbutton(Bar *bar, BarWidthArg *a) +width_stbutton(Bar *bar, BarArg *a) { return TEXTW(buttonbar); } int -draw_stbutton(Bar *bar, BarDrawArg *a) +draw_stbutton(Bar *bar, BarArg *a) { - return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, buttonbar, 0, False); + return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar, 0, False); } int -click_stbutton(Bar *bar, Arg *arg, BarClickArg *a) +click_stbutton(Bar *bar, Arg *arg, BarArg *a) { return ClkButton; } diff --git a/patch/bar_statusbutton.h b/patch/bar_statusbutton.h index 8e9d6fe..68ae839 100644 --- a/patch/bar_statusbutton.h +++ b/patch/bar_statusbutton.h @@ -1,3 +1,3 @@ -static int width_stbutton(Bar *bar, BarWidthArg *a); -static int draw_stbutton(Bar *bar, BarDrawArg *a); -static int click_stbutton(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file +static int width_stbutton(Bar *bar, BarArg *a); +static int draw_stbutton(Bar *bar, BarArg *a); +static int click_stbutton(Bar *bar, Arg *arg, BarArg *a); \ No newline at end of file diff --git a/patch/bar_statuscmd.c b/patch/bar_statuscmd.c index a73fbac..0a4ad72 100644 --- a/patch/bar_statuscmd.c +++ b/patch/bar_statuscmd.c @@ -5,16 +5,16 @@ static int lastbutton; #endif // BAR_DWMBLOCKS_PATCH int -click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a) +click_statuscmd(Bar *bar, Arg *arg, BarArg *a) { - return click_statuscmd_text(arg, a->rel_x, rawstext); + return click_statuscmd_text(arg, a->x, rawstext); } #if BAR_EXTRASTATUS_PATCH int -click_statuscmd_es(Bar *bar, Arg *arg, BarClickArg *a) +click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a) { - return click_statuscmd_text(arg, a->rel_x, rawestext); + return click_statuscmd_text(arg, a->x, rawestext); } #endif // BAR_EXTRASTATUS_PATCH diff --git a/patch/bar_statuscmd.h b/patch/bar_statuscmd.h index 0e1e184..e2e75b1 100644 --- a/patch/bar_statuscmd.h +++ b/patch/bar_statuscmd.h @@ -1,6 +1,6 @@ -static int click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a); +static int click_statuscmd(Bar *bar, Arg *arg, BarArg *a); #if BAR_EXTRASTATUS_PATCH -static int click_statuscmd_es(Bar *bar, Arg *arg, BarClickArg *a); +static int click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a); #endif // BAR_EXTRASTATUS_PATCH static int click_statuscmd_text(Arg *arg, int rel_x, char *text); static void copyvalidchars(char *text, char *rawtext); \ No newline at end of file diff --git a/patch/bar_systray.c b/patch/bar_systray.c index 5ca78f7..d3df37c 100644 --- a/patch/bar_systray.c +++ b/patch/bar_systray.c @@ -2,7 +2,7 @@ static Systray *systray = NULL; static unsigned long systrayorientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ; int -width_systray(Bar *bar, BarWidthArg *a) +width_systray(Bar *bar, BarArg *a) { unsigned int w = 0; Client *i; @@ -14,7 +14,7 @@ width_systray(Bar *bar, BarWidthArg *a) } int -draw_systray(Bar *bar, BarDrawArg *a) +draw_systray(Bar *bar, BarArg *a) { if (!showsystray) return 0; @@ -34,12 +34,12 @@ draw_systray(Bar *bar, BarDrawArg *a) #if BAR_ALPHA_PATCH wa.background_pixel = 0; wa.colormap = cmap; - systray->win = XCreateWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by, MAX(a->w + 40, 1), bar->bh, 0, depth, + systray->win = XCreateWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by + a->y, MAX(a->w + 40, 1), a->h, 0, depth, InputOutput, visual, CWOverrideRedirect|CWBorderPixel|CWBackPixel|CWColormap|CWEventMask, &wa); // CWBackPixmap #else wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; - systray->win = XCreateSimpleWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by, MIN(a->w, 1), bar->bh, 0, 0, scheme[SchemeNorm][ColBg].pixel); + systray->win = XCreateSimpleWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by + a->y, MIN(a->w, 1), a->h, 0, 0, scheme[SchemeNorm][ColBg].pixel); XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa); #endif // BAR_ALPHA_PATCH @@ -85,12 +85,12 @@ draw_systray(Bar *bar, BarDrawArg *a) i->mon = bar->mon; } - XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by : -bar->by), MAX(w, 1), bar->bh); + XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by + a->y : -bar->by - a->y), MAX(w, 1), a->h); return w; } int -click_systray(Bar *bar, Arg *arg, BarClickArg *a) +click_systray(Bar *bar, Arg *arg, BarArg *a) { return -1; } @@ -124,25 +124,29 @@ resizerequest(XEvent *e) void updatesystrayicongeom(Client *i, int w, int h) { + if (!systray) + return; + + int bar_height = systray->bar->bh - 2 * systray->bar->borderpx; if (i) { - i->h = bh; + i->h = bar_height; if (w == h) - i->w = bh; - else if (h == bh) + i->w = bar_height; + else if (h == bar_height) i->w = w; else - i->w = (int) ((float)bh * ((float)w / (float)h)); + i->w = (int) ((float)bar_height * ((float)w / (float)h)); applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False); /* force icons into the systray dimensions if they don't want to */ - if (i->h > bh) { + if (i->h > bar_height) { if (i->w == i->h) - i->w = bh; + i->w = bar_height; else - i->w = (int) ((float)bh * ((float)i->w / (float)i->h)); - i->h = bh; + i->w = (int) ((float)bar_height * ((float)i->w / (float)i->h)); + i->h = bar_height; } - if (i->w > 2*bh) - i->w = bh; + if (i->w > 2 * bar_height) + i->w = bar_height; } } diff --git a/patch/bar_systray.h b/patch/bar_systray.h index 5123a73..5a107f2 100644 --- a/patch/bar_systray.h +++ b/patch/bar_systray.h @@ -26,9 +26,9 @@ struct Systray { }; /* bar integration */ -static int width_systray(Bar *bar, BarWidthArg *a); -static int draw_systray(Bar *bar, BarDrawArg *a); -static int click_systray(Bar *bar, Arg *arg, BarClickArg *a); +static int width_systray(Bar *bar, BarArg *a); +static int draw_systray(Bar *bar, BarArg *a); +static int click_systray(Bar *bar, Arg *arg, BarArg *a); /* function declarations */ static Atom getatomprop(Client *c, Atom prop); diff --git a/patch/bar_tabgroups.c b/patch/bar_tabgroups.c index 153a533..b0bcdb1 100644 --- a/patch/bar_tabgroups.c +++ b/patch/bar_tabgroups.c @@ -16,27 +16,27 @@ #endif int -width_bartabgroups(Bar *bar, BarWidthArg *a) +width_bartabgroups(Bar *bar, BarArg *a) { - return a->max_width; + return a->w; } int -draw_bartabgroups(Bar *bar, BarDrawArg *a) +draw_bartabgroups(Bar *bar, BarArg *a) { - drw_rect(drw, a->x, 0, a->w, bh, 1, 1); - return bartabcalculate(bar->mon, a->x, a->w, -1, bartabdraw, NULL); + drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1); + return bartabcalculate(bar->mon, a->x, a->w, -1, bartabdraw, NULL, a); } int -click_bartabgroups(Bar *bar, Arg *arg, BarClickArg *a) +click_bartabgroups(Bar *bar, Arg *arg, BarArg *a) { - bartabcalculate(bar->mon, 0, a->rel_w, a->rel_x, bartabclick, arg); + bartabcalculate(bar->mon, 0, a->w, a->x, bartabclick, arg, a); return ClkWinTitle; } void -bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg) +bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg) { if (!c) return; @@ -59,14 +59,14 @@ bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg pad = (w - TEXTW(c->name) + lrpad) / 2; #endif // BAR_CENTEREDWINDOWNAME_PATCH - drw_text(drw, x, 0, w, bh, pad, c->name, 0, False); + drw_text(drw, x, barg->y, w, barg->h, pad, c->name, 0, False); if (c->isfloating) - drawindicator(m, c, 1, x, w, 0, 0, c->isfixed, floatindicatortype); + drawindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, c->isfixed, floatindicatortype); if (BARTAB_BORDERS) { XSetForeground(drw->dpy, drw->gc, scheme[SchemeSel][ColBorder].pixel); - XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, 0, 1, bh); - XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w, 0, 1, bh); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, barg->y, 1, barg->h); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= barg->w ? 1 : 0), barg->y, 1, barg->h); } /* Optional tags icons */ for (i = 0; i < NUMTAGS; i++) { @@ -77,7 +77,7 @@ bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg } if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1) - drawindicator(m, c, 1, x, w, 0, 0, 0, INDICATOR_RIGHT_TAGS); + drawindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, 0, INDICATOR_RIGHT_TAGS); } #ifndef HIDDEN @@ -85,7 +85,7 @@ bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg #endif void -bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg) +bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg) { if (passx >= x && passx <= x + w) arg->v = c; @@ -94,7 +94,8 @@ bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg int bartabcalculate( Monitor *m, int offx, int tabw, int passx, - void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), + Arg *arg, BarArg *barg ) { Client *c; int @@ -141,7 +142,7 @@ bartabcalculate( for (c = m->clients, i = 0; c; c = c->next) { if (!ISVISIBLE(c)) continue; - tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg); + tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg); x += w + (i < r ? 1 : 0); i++; } @@ -153,7 +154,7 @@ bartabcalculate( for (c = m->clients, i = 0; c; c = c->next) { if (!ISVISIBLE(c) || (c->isfloating && !HIDDEN(c))) continue; - tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg); + tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg); x += w + (i < r ? 1 : 0); i++; } @@ -172,7 +173,7 @@ bartabcalculate( for (; c && i < m->nmaster; c = c->next) { // tiled master if (!ISVISIBLE(c) || c->isfloating || HIDDEN(c)) continue; - tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg); + tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg); x += w + (i < r ? 1 : 0); i++; } @@ -190,7 +191,7 @@ bartabcalculate( for (; c; c = c->next) { // tiled stack if (!ISVISIBLE(c) || HIDDEN(c) || c->isfloating) continue; - tabfn(m, c, passx, x, w * BARTAB_STACKWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg); + tabfn(m, c, passx, x, w * BARTAB_STACKWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg); x += w * BARTAB_STACKWEIGHT + (i - m->nmaster < r ? 1 : 0); i++; } @@ -200,7 +201,7 @@ bartabcalculate( for (c = m->clients; c; c = c->next) { // hidden windows if (!ISVISIBLE(c) || !HIDDEN(c)) continue; - tabfn(m, c, passx, x, w * BARTAB_HIDDENWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg); + tabfn(m, c, passx, x, w * BARTAB_HIDDENWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg); x += w * BARTAB_HIDDENWEIGHT + (i - m->nmaster < r ? 1 : 0); i++; } @@ -210,7 +211,7 @@ bartabcalculate( for (c = m->clients; c; c = c->next) { // floating windows if (!ISVISIBLE(c) || HIDDEN(c) || !c->isfloating) continue; - tabfn(m, c, passx, x, w * BARTAB_FLOATWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg); + tabfn(m, c, passx, x, w * BARTAB_FLOATWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg); x += w * BARTAB_FLOATWEIGHT + (i - m->nmaster < r ? 1 : 0); i++; } diff --git a/patch/bar_tabgroups.h b/patch/bar_tabgroups.h index 113701f..e118c0d 100644 --- a/patch/bar_tabgroups.h +++ b/patch/bar_tabgroups.h @@ -1,7 +1,7 @@ -static int width_bartabgroups(Bar *bar, BarWidthArg *a); -static int draw_bartabgroups(Bar *bar, BarDrawArg *a); -static int click_bartabgroups(Bar *bar, Arg *arg, BarClickArg *a); +static int width_bartabgroups(Bar *bar, BarArg *a); +static int draw_bartabgroups(Bar *bar, BarArg *a); +static int click_bartabgroups(Bar *bar, Arg *arg, BarArg *a); -static void bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg); -static void bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg); -static int bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); \ No newline at end of file +static void bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg); +static void bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg); +static int bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg); \ No newline at end of file diff --git a/patch/bar_taggrid.c b/patch/bar_taggrid.c index 1c782da..387f25b 100644 --- a/patch/bar_taggrid.c +++ b/patch/bar_taggrid.c @@ -1,11 +1,11 @@ int -width_taggrid(Bar *bar, BarWidthArg *a) +width_taggrid(Bar *bar, BarArg *a) { - return (bh / 2) * (NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0)) + lrpad; + return (a->h / 2) * (NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0)) + lrpad; } int -draw_taggrid(Bar *bar, BarDrawArg *a) +draw_taggrid(Bar *bar, BarArg *a) { unsigned int x, y, h, max_x = 0, columns, occ = 0; int invert, i,j, k; @@ -15,13 +15,13 @@ draw_taggrid(Bar *bar, BarDrawArg *a) occ |= c->tags; max_x = x = a->x + lrpad / 2; - h = bh / tagrows; - y = 0; + h = a->h / tagrows - 1; + y = a->y; columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0); /* Firstly we will fill the borders of squares */ XSetForeground(drw->dpy, drw->gc, scheme[SchemeTagsNorm][ColBg].pixel); - XFillRectangle(dpy, drw->drawable, drw->gc, x, y, h*columns + 1, bh); + XFillRectangle(dpy, drw->drawable, drw->gc, x, y, h*columns + 1, a->h); /* We will draw NUMTAGS squares in tagraws raws. */ for (j = 0, i = 0; j < tagrows; j++) { @@ -57,12 +57,13 @@ draw_taggrid(Bar *bar, BarDrawArg *a) } int -click_taggrid(Bar *bar, Arg *arg, BarClickArg *a) +click_taggrid(Bar *bar, Arg *arg, BarArg *a) { - unsigned int i, columns; + unsigned int i, h, columns; + h = a->h / tagrows - 1; columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0); - i = (a->rel_x - lrpad / 2) / (bh / tagrows) + columns * (a->rel_y / (bh / tagrows)); + i = (a->x - lrpad / 2) / h + columns * (a->y / h); if (i >= NUMTAGS) { i = NUMTAGS - 1; } diff --git a/patch/bar_taggrid.h b/patch/bar_taggrid.h index c35b337..e0c824e 100644 --- a/patch/bar_taggrid.h +++ b/patch/bar_taggrid.h @@ -1,4 +1,4 @@ -static int width_taggrid(Bar *bar, BarWidthArg *a); -static int draw_taggrid(Bar *bar, BarDrawArg *a); -static int click_taggrid(Bar *bar, Arg *arg, BarClickArg *a); +static int width_taggrid(Bar *bar, BarArg *a); +static int draw_taggrid(Bar *bar, BarArg *a); +static int click_taggrid(Bar *bar, Arg *arg, BarArg *a); static void switchtag(const Arg *arg); \ No newline at end of file diff --git a/patch/bar_tags.c b/patch/bar_tags.c index dd57e0b..df83144 100644 --- a/patch/bar_tags.c +++ b/patch/bar_tags.c @@ -1,5 +1,5 @@ int -width_tags(Bar *bar, BarWidthArg *a) +width_tags(Bar *bar, BarArg *a) { int w, i; #if BAR_HIDEVACANTTAGS_PATCH @@ -20,7 +20,7 @@ width_tags(Bar *bar, BarWidthArg *a) } int -draw_tags(Bar *bar, BarDrawArg *a) +draw_tags(Bar *bar, BarArg *a) { int invert; int w, x = a->x; @@ -55,8 +55,8 @@ draw_tags(Bar *bar, BarDrawArg *a) ? SchemeUrg : SchemeTagsNorm ]); - drw_text(drw, x, 0, w, bh, lrpad / 2, icon, invert, False); - drawindicator(m, NULL, occ, x, w, i, -1, invert, tagindicatortype); + drw_text(drw, x, a->y, w, a->h, lrpad / 2, icon, invert, False); + drawindicator(m, NULL, occ, x, a->y, w, a->h, i, -1, invert, tagindicatortype); x += w; } @@ -64,7 +64,7 @@ draw_tags(Bar *bar, BarDrawArg *a) } int -click_tags(Bar *bar, Arg *arg, BarClickArg *a) +click_tags(Bar *bar, Arg *arg, BarArg *a) { int i = 0, x = lrpad / 2; #if BAR_HIDEVACANTTAGS_PATCH @@ -80,7 +80,7 @@ click_tags(Bar *bar, Arg *arg, BarClickArg *a) continue; #endif // BAR_HIDEVACANTTAGS_PATCH x += TEXTW(tagicon(bar->mon, i)); - } while (a->rel_x >= x && ++i < NUMTAGS); + } while (a->x >= x && ++i < NUMTAGS); if (i < NUMTAGS) { arg->ui = 1 << i; } diff --git a/patch/bar_tags.h b/patch/bar_tags.h index 033130e..9ab784b 100644 --- a/patch/bar_tags.h +++ b/patch/bar_tags.h @@ -1,3 +1,3 @@ -static int width_tags(Bar *bar, BarWidthArg *a); -static int draw_tags(Bar *bar, BarDrawArg *a); -static int click_tags(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file +static int width_tags(Bar *bar, BarArg *a); +static int draw_tags(Bar *bar, BarArg *a); +static int click_tags(Bar *bar, Arg *arg, BarArg *a); \ No newline at end of file diff --git a/patch/bar_wintitle.c b/patch/bar_wintitle.c index 7b2cd5a..ae2efce 100644 --- a/patch/bar_wintitle.c +++ b/patch/bar_wintitle.c @@ -1,11 +1,11 @@ int -width_wintitle(Bar *bar, BarWidthArg *a) +width_wintitle(Bar *bar, BarArg *a) { - return a->max_width; + return a->w; } int -draw_wintitle(Bar *bar, BarDrawArg *a) +draw_wintitle(Bar *bar, BarArg *a) { #if BAR_TITLE_LEFT_PAD_PATCH && BAR_TITLE_RIGHT_PAD_PATCH int x = a->x + lrpad / 2, w = a->w - lrpad; @@ -21,7 +21,7 @@ draw_wintitle(Bar *bar, BarDrawArg *a) if (!m->sel) { drw_setscheme(drw, scheme[SchemeTitleNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); + drw_rect(drw, x, a->y, w, a->h, 1, 1); return 0; } @@ -33,18 +33,18 @@ draw_wintitle(Bar *bar, BarDrawArg *a) if (TEXTW(m->sel->name) < w) pad = (w - TEXTW(m->sel->name) + lrpad) / 2; #endif // BAR_CENTEREDWINDOWNAME_PATCH - drw_text(drw, x, 0, w, bh, pad, m->sel->name, 0, False); + drw_text(drw, x, a->y, w, a->h, pad, m->sel->name, 0, False); #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH XSync(dpy, False); XSetErrorHandler(xerror); #endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH if (m->sel->isfloating) - drawindicator(m, m->sel, 1, x, w, 0, 0, m->sel->isfixed, floatindicatortype); + drawindicator(m, m->sel, 1, x, a->y, w, a->h, 0, 0, m->sel->isfixed, floatindicatortype); return 1; } int -click_wintitle(Bar *bar, Arg *arg, BarClickArg *a) +click_wintitle(Bar *bar, Arg *arg, BarArg *a) { return ClkWinTitle; } diff --git a/patch/bar_wintitle.h b/patch/bar_wintitle.h index 6d055a6..349f948 100644 --- a/patch/bar_wintitle.h +++ b/patch/bar_wintitle.h @@ -1,3 +1,3 @@ -static int width_wintitle(Bar *bar, BarWidthArg *a); -static int draw_wintitle(Bar *bar, BarDrawArg *a); -static int click_wintitle(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file +static int width_wintitle(Bar *bar, BarArg *a); +static int draw_wintitle(Bar *bar, BarArg *a); +static int click_wintitle(Bar *bar, Arg *arg, BarArg *a); \ No newline at end of file diff --git a/patch/bar_wintitle_floating.c b/patch/bar_wintitle_floating.c index e4aea1d..001486b 100644 --- a/patch/bar_wintitle_floating.c +++ b/patch/bar_wintitle_floating.c @@ -1,27 +1,28 @@ int -width_wintitle_floating(Bar *bar, BarWidthArg *a) +width_wintitle_floating(Bar *bar, BarArg *a) { - return a->max_width; + return a->w; } int -draw_wintitle_floating(Bar *bar, BarDrawArg *a) +draw_wintitle_floating(Bar *bar, BarArg *a) { - drw_rect(drw, a->x, 0, a->w, bh, 1, 1); - return calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL);; + drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1); + return calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a); } int -click_wintitle_floating(Bar *bar, Arg *arg, BarClickArg *a) +click_wintitle_floating(Bar *bar, Arg *arg, BarArg *a) { - calc_wintitle_floating(bar->mon, 0, a->rel_w, a->rel_x, flextitleclick, arg); + calc_wintitle_floating(bar->mon, 0, a->w, a->x, flextitleclick, arg, a); return ClkWinTitle; } int calc_wintitle_floating( Monitor *m, int offx, int tabw, int passx, - void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), + Arg *arg, BarArg *barg ) { Client *c; int clientsnfloating = 0, w, r; @@ -39,6 +40,6 @@ calc_wintitle_floating( w = tabw / clientsnfloating; r = tabw % clientsnfloating; - c = flextitledrawarea(m, m->clients, offx, r, w, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg); + c = flextitledrawarea(m, m->clients, offx, r, w, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg, barg); return 1; } \ No newline at end of file diff --git a/patch/bar_wintitle_floating.h b/patch/bar_wintitle_floating.h index 7c6a5c1..d04569c 100644 --- a/patch/bar_wintitle_floating.h +++ b/patch/bar_wintitle_floating.h @@ -1,7 +1,8 @@ -static int width_wintitle_floating(Bar *bar, BarWidthArg *a); -static int draw_wintitle_floating(Bar *bar, BarDrawArg *a); -static int click_wintitle_floating(Bar *bar, Arg *arg, BarClickArg *a); +static int width_wintitle_floating(Bar *bar, BarArg *a); +static int draw_wintitle_floating(Bar *bar, BarArg *a); +static int click_wintitle_floating(Bar *bar, Arg *arg, BarArg *a); static int calc_wintitle_floating( Monitor *m, int offx, int tabw, int passx, - void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), + Arg *arg, BarArg *barg ); \ No newline at end of file diff --git a/patch/bar_wintitle_hidden.c b/patch/bar_wintitle_hidden.c index 95e8378..1fa12bc 100644 --- a/patch/bar_wintitle_hidden.c +++ b/patch/bar_wintitle_hidden.c @@ -1,27 +1,28 @@ int -width_wintitle_hidden(Bar *bar, BarWidthArg *a) +width_wintitle_hidden(Bar *bar, BarArg *a) { - return a->max_width; + return a->w; } int -draw_wintitle_hidden(Bar *bar, BarDrawArg *a) +draw_wintitle_hidden(Bar *bar, BarArg *a) { - drw_rect(drw, a->x, 0, a->w, bh, 1, 1); - return calc_wintitle_hidden(bar->mon, a->x, a->w, -1, flextitledraw, NULL);; + drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1); + return calc_wintitle_hidden(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a); } int -click_wintitle_hidden(Bar *bar, Arg *arg, BarClickArg *a) +click_wintitle_hidden(Bar *bar, Arg *arg, BarArg *a) { - calc_wintitle_hidden(bar->mon, 0, a->rel_w, a->rel_x, flextitleclick, arg); + calc_wintitle_hidden(bar->mon, 0, a->w, a->x, flextitleclick, arg, a); return ClkWinTitle; } int calc_wintitle_hidden( Monitor *m, int offx, int tabw, int passx, - void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), + Arg *arg, BarArg *barg ) { Client *c; int clientsnhidden = 0, w, r; @@ -39,6 +40,6 @@ calc_wintitle_hidden( w = tabw / clientsnhidden; r = tabw % clientsnhidden; - c = flextitledrawarea(m, m->clients, offx, r, w, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg); + c = flextitledrawarea(m, m->clients, offx, r, w, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg, barg); return 1; } \ No newline at end of file diff --git a/patch/bar_wintitle_hidden.h b/patch/bar_wintitle_hidden.h index aaa1be7..e757391 100644 --- a/patch/bar_wintitle_hidden.h +++ b/patch/bar_wintitle_hidden.h @@ -1,7 +1,8 @@ -static int width_wintitle_hidden(Bar *bar, BarWidthArg *a); -static int draw_wintitle_hidden(Bar *bar, BarDrawArg *a); -static int click_wintitle_hidden(Bar *bar, Arg *arg, BarClickArg *a); +static int width_wintitle_hidden(Bar *bar, BarArg *a); +static int draw_wintitle_hidden(Bar *bar, BarArg *a); +static int click_wintitle_hidden(Bar *bar, Arg *arg, BarArg *a); static int calc_wintitle_hidden( Monitor *m, int offx, int tabw, int passx, - void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), + Arg *arg, BarArg *barg ); \ No newline at end of file diff --git a/patch/fullscreen.c b/patch/fullscreen.c index f0f2726..a89d40d 100644 --- a/patch/fullscreen.c +++ b/patch/fullscreen.c @@ -3,9 +3,11 @@ Layout *last_layout; void fullscreen(const Arg *arg) { - int monocle_pos; + int monocle_pos = 0; if (selmon->showbar || last_layout == NULL) { + #if MONOCLE_LAYOUT for (monocle_pos = 0, last_layout = (Layout *)layouts; !last_layout->arrange || last_layout->arrange != &monocle; monocle_pos++, last_layout++ ); + #endif // MONOCLE_LAYOUT for (last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++); setlayout(&((Arg) { .v = &layouts[monocle_pos] })); } else { diff --git a/patch/layout_flextile-deluxe.c b/patch/layout_flextile-deluxe.c index d289241..a23a3c0 100644 --- a/patch/layout_flextile-deluxe.c +++ b/patch/layout_flextile-deluxe.c @@ -66,7 +66,7 @@ getfactsforrange(Monitor *m, int an, int ai, int size, int *rest, float *fact) *fact = facts; } -#if DWMC_PATCH +#if IPC_PATCH || DWMC_PATCH static void setlayoutaxisex(const Arg *arg) { @@ -85,7 +85,7 @@ setlayoutaxisex(const Arg *arg) #endif // PERTAG_PATCH arrange(selmon); } -#endif // DWMC_PATCH +#endif // IPC_PATCH | DWMC_PATCH static void layout_no_split(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n) diff --git a/patch/layout_flextile-deluxe.h b/patch/layout_flextile-deluxe.h index 01bce7b..253e76b 100644 --- a/patch/layout_flextile-deluxe.h +++ b/patch/layout_flextile-deluxe.h @@ -2,9 +2,9 @@ static void flextile(Monitor *m); static void getfactsforrange(Monitor *m, int an, int ai, int size, int *rest, float *fact); static void mirrorlayout(const Arg *arg); static void rotatelayoutaxis(const Arg *arg); -#if DWMC_PATCH +#if IPC_PATCH || DWMC_PATCH static void setlayoutaxisex(const Arg *arg); -#endif // DWMC_PATCH +#endif // IPC_PATCH | DWMC_PATCH static void incnstack(const Arg *arg); /* Symbol handlers */ diff --git a/patch/scratchpad_alt_1.h b/patch/scratchpad_alt_1.h index 6248c88..5cc2e2f 100644 --- a/patch/scratchpad_alt_1.h +++ b/patch/scratchpad_alt_1.h @@ -1,4 +1,4 @@ -# define SCRATCHPAD_MASK (1u << sizeof tags / sizeof * tags) +#define SCRATCHPAD_MASK (1u << NUMTAGS) static void scratchpad_hide (); static _Bool scratchpad_last_showed_is_killed (void); diff --git a/patch/tagothermonitor.c b/patch/tagothermonitor.c index 4572c88..ddeaff8 100644 --- a/patch/tagothermonitor.c +++ b/patch/tagothermonitor.c @@ -1,4 +1,4 @@ -#if DWMC_PATCH +#if IPC_PATCH || DWMC_PATCH void tagnextmonex(const Arg *arg) { @@ -10,7 +10,7 @@ tagprevmonex(const Arg *arg) { tagprevmon(&((Arg) { .ui = 1 << arg->ui })); } -#endif // DWMC_PATCH +#endif // IPC_PATCH | DWMC_PATCH void tagnextmon(const Arg *arg) diff --git a/patch/tagothermonitor.h b/patch/tagothermonitor.h index 5cc033f..e2aa24f 100644 --- a/patch/tagothermonitor.h +++ b/patch/tagothermonitor.h @@ -1,7 +1,7 @@ -#if DWMC_PATCH +#if IPC_PATCH || DWMC_PATCH static void tagnextmonex(const Arg *arg); static void tagprevmonex(const Arg *arg); -#endif // DWMC_PATCH +#endif // IPC_PATCH | DWMC_PATCH static void tagnextmon(const Arg *arg); static void tagprevmon(const Arg *arg); diff --git a/patch/vanitygaps.c b/patch/vanitygaps.c index 5b8c7c1..dd579de 100644 --- a/patch/vanitygaps.c +++ b/patch/vanitygaps.c @@ -18,7 +18,7 @@ setgaps(int oh, int ov, int ih, int iv) arrange(selmon); } -#if DWMC_PATCH || IPC_PATCH +#if IPC_PATCH || DWMC_PATCH /* External function that takes one integer and splits it * into four gap values: * - outer horizontal (oh) @@ -70,7 +70,7 @@ setgapsex(const Arg *arg) setgaps(oh, ov, ih, iv); } -#endif // DWMC_PATCH | IPC_PATCH +#endif // IPC_PATCH | DWMC_PATCH static void togglegaps(const Arg *arg) diff --git a/patch/vanitygaps.h b/patch/vanitygaps.h index 1c5f0d7..c3eb622 100644 --- a/patch/vanitygaps.h +++ b/patch/vanitygaps.h @@ -14,6 +14,6 @@ static void togglegaps(const Arg *arg); static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc); #endif static void setgaps(int oh, int ov, int ih, int iv); -#if DWMC_PATCH +#if IPC_PATCH || DWMC_PATCH static void setgapsex(const Arg *arg); -#endif // DWMC_PATCH \ No newline at end of file +#endif // IPC_PATCH | DWMC_PATCH \ No newline at end of file diff --git a/patch/xrdb.c b/patch/xrdb.c index 7718b49..e8633cd 100644 --- a/patch/xrdb.c +++ b/patch/xrdb.c @@ -83,7 +83,7 @@ loadxrdb() XRDB_LOAD_COLOR("dwm.selSPRLbgcolor", selSPRLbgcolor); XRDB_LOAD_COLOR("dwm.selfloatbgcolor", selfloatbgcolor); #endif // BAR_FLEXWINTITLE_PATCH - #if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH + #if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH && BAR_STATUS2D_PATCH XRDB_LOAD_COLOR("color0", termcol0); XRDB_LOAD_COLOR("color1", termcol1); XRDB_LOAD_COLOR("color2", termcol2); diff --git a/patches.def.h b/patches.def.h index 4a5048d..d0b49d3 100644 --- a/patches.def.h +++ b/patches.def.h @@ -184,6 +184,11 @@ */ #define BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH N/A +/* This patch adds a border around the status bar(s) just like the border of client windows. + * https://codemadness.org/paste/dwm-border-bar.patch + */ +#define BAR_BORDER_PATCH 0 + /* This patch centers the WM_NAME of the currently selected window on the status bar. * This is compatible with the wintitle, bartabgroups, flexwintitle and awesomebar bar * modules.