summaryrefslogtreecommitdiffhomepage
path: root/patch/bar_taggrid.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-09-09 17:24:02 +0200
committerbakkeby <[email protected]>2020-09-09 17:24:02 +0200
commitff9811f73d1f3d47a6ab7a2a7e44308bf849fb44 (patch)
treeded58addbdbcf61bdf8eaa99d9c67f46d1f8921d /patch/bar_taggrid.c
parentb3e6e3531b79b4bcd6938f291f9658ca5bbc5dd2 (diff)
downloaddwm-flexipatch-ff9811f73d1f3d47a6ab7a2a7e44308bf849fb44.tar.gz
dwm-flexipatch-ff9811f73d1f3d47a6ab7a2a7e44308bf849fb44.zip
Just some minor changes adding bar border patch ref. #41
Diffstat (limited to 'patch/bar_taggrid.c')
-rw-r--r--patch/bar_taggrid.c19
1 files changed, 10 insertions, 9 deletions
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;
}