summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-07-15 14:10:47 +0200
committerbakkeby <[email protected]>2020-07-15 14:10:47 +0200
commitaa70728d0049f771820f17cfca4488768cf57cef (patch)
tree6c04dd37b98a70b6f9aedf15e9ece315f7d89933 /patch
parentf2da4d20d9a79070863972423ca964cf65342ba7 (diff)
downloaddwm-flexipatch-aa70728d0049f771820f17cfca4488768cf57cef.tar.gz
dwm-flexipatch-aa70728d0049f771820f17cfca4488768cf57cef.zip
Adding BarWidthArg, BarDrawArg, BarClickArg to keep the method signatures static
Diffstat (limited to 'patch')
-rw-r--r--patch/bar_awesomebar.c20
-rw-r--r--patch/bar_awesomebar.h6
-rw-r--r--patch/bar_fancybar.c10
-rw-r--r--patch/bar_fancybar.h6
-rw-r--r--patch/bar_ltsymbol.c10
-rw-r--r--patch/bar_ltsymbol.h6
-rw-r--r--patch/bar_status.c10
-rw-r--r--patch/bar_status.h6
-rw-r--r--patch/bar_status2d.c8
-rw-r--r--patch/bar_status2d.h6
-rw-r--r--patch/bar_status2d_eb.c6
-rw-r--r--patch/bar_status2d_eb.h4
-rw-r--r--patch/bar_statusbutton.c10
-rw-r--r--patch/bar_statusbutton.h6
-rw-r--r--patch/bar_statuscmd.c10
-rw-r--r--patch/bar_statuscmd.h6
-rw-r--r--patch/bar_systray.c10
-rw-r--r--patch/bar_systray.h6
-rw-r--r--patch/bar_taggrid.c12
-rw-r--r--patch/bar_taggrid.h6
-rw-r--r--patch/bar_tags.c9
-rw-r--r--patch/bar_tags.h6
-rw-r--r--patch/bar_vtcolors.c70
-rw-r--r--patch/bar_vtcolors.h2
-rw-r--r--patch/bar_wintitle.c31
-rw-r--r--patch/bar_wintitle.h6
26 files changed, 175 insertions, 113 deletions
diff --git a/patch/bar_awesomebar.c b/patch/bar_awesomebar.c
index 85ec003..ddea5ea 100644
--- a/patch/bar_awesomebar.c
+++ b/patch/bar_awesomebar.c
@@ -1,22 +1,22 @@
int
-width_awesomebar(Monitor *m, int max_width)
+width_awesomebar(Monitor *m, BarWidthArg *a)
{
- return max_width;
+ return a->max_width;
}
int
-draw_awesomebar(Monitor *m, int x_orig, int w)
+draw_awesomebar(Monitor *m, BarDrawArg *a)
{
int n = 0, scm, remainder = 0, tabw;
- unsigned int i, x = x_orig;
+ unsigned int i, x = a->x;
Client *c;
for (c = m->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
if (n > 0) {
- remainder = w % n;
- tabw = w / n;
+ remainder = a->w % n;
+ tabw = a->w / n;
for (i = 0, c = m->clients; c; c = c->next, i++) {
if (!ISVISIBLE(c))
continue;
@@ -46,11 +46,11 @@ draw_awesomebar(Monitor *m, int x_orig, int w)
x += tabw;
}
}
- return x_orig + w;
+ return a->x + a->w;
}
int
-click_awesomebar(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_awesomebar(Monitor *m, Arg *arg, BarClickArg *a)
{
int x = 0, n = 0;
Client *c;
@@ -65,8 +65,8 @@ click_awesomebar(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_
if (!c || !ISVISIBLE(c))
continue;
else
- x += (1.0 / (double)n) * rel_w;
- } while (c && rel_x > x && (c = c->next));
+ x += (1.0 / (double)n) * a->rel_w;
+ } while (c && a->rel_x > x && (c = c->next));
if (c) {
arg->v = c;
diff --git a/patch/bar_awesomebar.h b/patch/bar_awesomebar.h
index 84c8505..8e9387b 100644
--- a/patch/bar_awesomebar.h
+++ b/patch/bar_awesomebar.h
@@ -1,6 +1,6 @@
-static int width_awesomebar(Monitor *m, int max_width);
-static int draw_awesomebar(Monitor *m, int x, int w);
-static int click_awesomebar(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h);
+static int width_awesomebar(Monitor *m, BarWidthArg *a);
+static int draw_awesomebar(Monitor *m, BarDrawArg *a);
+static int click_awesomebar(Monitor *m, Arg *arg, BarClickArg *a);
static void hide(Client *c);
static void show(Client *c);
diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c
index b6f5363..810c73e 100644
--- a/patch/bar_fancybar.c
+++ b/patch/bar_fancybar.c
@@ -1,13 +1,13 @@
int
-width_fancybar(Monitor *m, int max_width)
+width_fancybar(Monitor *m, BarWidthArg *a)
{
- return max_width;
+ return a->max_width;
}
int
-draw_fancybar(Monitor *m, int x, int w)
+draw_fancybar(Monitor *m, BarDrawArg *a)
{
- int ftw, mw, ew = 0, n = 0;
+ int ftw, mw, ew = 0, n = 0, x = a->x, w = a->w;
unsigned int i;
Client *c;
#if !BAR_HIDEVACANTTAGS_PATCH
@@ -89,7 +89,7 @@ draw_fancybar(Monitor *m, int x, int w)
}
int
-click_fancybar(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_fancybar(Monitor *m, Arg *arg, BarClickArg *a)
{
return ClkWinTitle;
}
diff --git a/patch/bar_fancybar.h b/patch/bar_fancybar.h
index 24336d9..b7b2875 100644
--- a/patch/bar_fancybar.h
+++ b/patch/bar_fancybar.h
@@ -1,3 +1,3 @@
-static int width_fancybar(Monitor *m, int max_width);
-static int draw_fancybar(Monitor *m, int x, int w);
-static int click_fancybar(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h); \ No newline at end of file
+static int width_fancybar(Monitor *m, BarWidthArg *a);
+static int draw_fancybar(Monitor *m, BarDrawArg *a);
+static int click_fancybar(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_ltsymbol.c b/patch/bar_ltsymbol.c
index f4417f1..c3a7baf 100644
--- a/patch/bar_ltsymbol.c
+++ b/patch/bar_ltsymbol.c
@@ -1,21 +1,21 @@
int
-width_ltsymbol(Monitor *m, int max_width)
+width_ltsymbol(Monitor *m, BarWidthArg *a)
{
return TEXTW(m->ltsymbol);
}
int
-draw_ltsymbol(Monitor *m, int x, int w)
+draw_ltsymbol(Monitor *m, BarDrawArg *a)
{
#if BAR_PANGO_PATCH
- return drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0, False);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, m->ltsymbol, 0, False);
#else
- return drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, m->ltsymbol, 0);
#endif // BAR_PANGO_PATCH
}
int
-click_ltsymbol(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_ltsymbol(Monitor *m, Arg *arg, BarClickArg *a)
{
return ClkLtSymbol;
} \ No newline at end of file
diff --git a/patch/bar_ltsymbol.h b/patch/bar_ltsymbol.h
index 5471496..40f5c55 100644
--- a/patch/bar_ltsymbol.h
+++ b/patch/bar_ltsymbol.h
@@ -1,3 +1,3 @@
-static int width_ltsymbol(Monitor *m, int max_width);
-static int draw_ltsymbol(Monitor *m, int x, int w);
-static int click_ltsymbol(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h);
+static int width_ltsymbol(Monitor *m, BarWidthArg *a);
+static int draw_ltsymbol(Monitor *m, BarDrawArg *a);
+static int click_ltsymbol(Monitor *m, Arg *arg, BarClickArg *a);
diff --git a/patch/bar_status.c b/patch/bar_status.c
index fdf72de..2d7283b 100644
--- a/patch/bar_status.c
+++ b/patch/bar_status.c
@@ -1,5 +1,5 @@
int
-width_status(Monitor *m, int max_width)
+width_status(Monitor *m, BarWidthArg *a)
{
#if BAR_PANGO_PATCH
return TEXTWM(stext) - lrpad + 2; /* 2px right padding */
@@ -9,17 +9,17 @@ width_status(Monitor *m, int max_width)
}
int
-draw_status(Monitor *m, int x, int w)
+draw_status(Monitor *m, BarDrawArg *a)
{
#if BAR_PANGO_PATCH
- return drw_text(drw, x, 0, w, bh, 0, stext, 0, True);
+ return drw_text(drw, a->x, 0, a->w, bh, 0, stext, 0, True);
#else
- return drw_text(drw, x, 0, w, bh, 0, stext, 0);
+ return drw_text(drw, a->x, 0, a->w, bh, 0, stext, 0);
#endif // BAR_PANGO_PATCH
}
int
-click_status(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_status(Monitor *m, Arg *arg, BarClickArg *a)
{
return ClkStatusText;
}
diff --git a/patch/bar_status.h b/patch/bar_status.h
index 3b6c924..97cf8b8 100644
--- a/patch/bar_status.h
+++ b/patch/bar_status.h
@@ -1,3 +1,3 @@
-static int width_status(Monitor *m, int max_width);
-static int draw_status(Monitor *m, int x, int w);
-static int click_status(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h); \ No newline at end of file
+static int width_status(Monitor *m, BarWidthArg *a);
+static int draw_status(Monitor *m, BarDrawArg *a);
+static int click_status(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_status2d.c b/patch/bar_status2d.c
index 8b3b3e5..61ebd69 100644
--- a/patch/bar_status2d.c
+++ b/patch/bar_status2d.c
@@ -1,17 +1,17 @@
int
-width_status2d(Monitor *m, int max_width)
+width_status2d(Monitor *m, BarWidthArg *a)
{
return status2dtextlength(rawstext);
}
int
-draw_status2d(Monitor *m, int x, int w)
+draw_status2d(Monitor *m, BarDrawArg *a)
{
- return drawstatusbar(m, x, w, rawstext);
+ return drawstatusbar(m, a->x, a->w, rawstext);
}
int
-click_status2d(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_status2d(Monitor *m, Arg *arg, BarClickArg *a)
{
return ClkStatusText;
}
diff --git a/patch/bar_status2d.h b/patch/bar_status2d.h
index 3f1a346..621fb7f 100644
--- a/patch/bar_status2d.h
+++ b/patch/bar_status2d.h
@@ -1,5 +1,5 @@
-static int width_status2d(Monitor *m, int max_width);
-static int draw_status2d(Monitor *m, int x, int w);
-static int click_status2d(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h);
+static int width_status2d(Monitor *m, BarWidthArg *a);
+static int draw_status2d(Monitor *m, BarDrawArg *a);
+static int click_status2d(Monitor *m, Arg *arg, BarClickArg *a);
static int drawstatusbar(Monitor *m, int x, int w, char* text);
static int status2dtextlength(char* stext); \ No newline at end of file
diff --git a/patch/bar_status2d_eb.c b/patch/bar_status2d_eb.c
index adce774..3e98866 100644
--- a/patch/bar_status2d_eb.c
+++ b/patch/bar_status2d_eb.c
@@ -1,11 +1,11 @@
int
-width_status2d_eb(Monitor *m, int max_width)
+width_status2d_eb(Monitor *m, BarWidthArg *a)
{
return status2dtextlength(rawestext);
}
int
-draw_status2d_eb(Monitor *m, int x, int w)
+draw_status2d_eb(Monitor *m, BarDrawArg *a)
{
- return drawstatusbar(m, x, w, rawestext);
+ return drawstatusbar(m, a->x, a->w, rawestext);
} \ No newline at end of file
diff --git a/patch/bar_status2d_eb.h b/patch/bar_status2d_eb.h
index 87b41fb..2a43537 100644
--- a/patch/bar_status2d_eb.h
+++ b/patch/bar_status2d_eb.h
@@ -1,2 +1,2 @@
-static int width_status2d_eb(Monitor *m, int max_width);
-static int draw_status2d_eb(Monitor *m, int x, int w); \ No newline at end of file
+static int width_status2d_eb(Monitor *m, BarWidthArg *a);
+static int draw_status2d_eb(Monitor *m, BarDrawArg *a); \ No newline at end of file
diff --git a/patch/bar_statusbutton.c b/patch/bar_statusbutton.c
index 130ef62..5f60b76 100644
--- a/patch/bar_statusbutton.c
+++ b/patch/bar_statusbutton.c
@@ -1,21 +1,21 @@
int
-width_stbutton(Monitor *m, int max_width)
+width_stbutton(Monitor *m, BarWidthArg *a)
{
return TEXTW(buttonbar);
}
int
-draw_stbutton(Monitor *m, int x, int w)
+draw_stbutton(Monitor *m, BarDrawArg *a)
{
#if BAR_PANGO_PATCH
- return drw_text(drw, x, 0, w, bh, lrpad / 2, buttonbar, 0, False);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, buttonbar, 0, False);
#else
- return drw_text(drw, x, 0, w, bh, lrpad / 2, buttonbar, 0);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, buttonbar, 0);
#endif // BAR_PANGO_PATCH
}
int
-click_stbutton(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_stbutton(Monitor *m, Arg *arg, BarClickArg *a)
{
return ClkButton;
}
diff --git a/patch/bar_statusbutton.h b/patch/bar_statusbutton.h
index 84ac2c5..47055ad 100644
--- a/patch/bar_statusbutton.h
+++ b/patch/bar_statusbutton.h
@@ -1,3 +1,3 @@
-static int width_stbutton(Monitor *m, int max_width);
-static int draw_stbutton(Monitor *m, int x, int w);
-static int click_stbutton(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h); \ No newline at end of file
+static int width_stbutton(Monitor *m, BarWidthArg *a);
+static int draw_stbutton(Monitor *m, BarDrawArg *a);
+static int click_stbutton(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_statuscmd.c b/patch/bar_statuscmd.c
index f6166c3..14b4076 100644
--- a/patch/bar_statuscmd.c
+++ b/patch/bar_statuscmd.c
@@ -5,21 +5,21 @@ static int lastbutton;
#endif // BAR_DWMBLOCKS_PATCH
int
-click_statuscmd(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_statuscmd(Monitor *m, Arg *arg, BarClickArg *a)
{
- return click_statuscmd_text(m, arg, rel_x, rel_y, rawstext);
+ return click_statuscmd_text(m, arg, a->rel_x, rawstext);
}
#if BAR_EXTRABAR_PATCH
int
-click_statuscmd_eb(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_statuscmd_eb(Monitor *m, Arg *arg, BarClickArg *a)
{
- return click_statuscmd_text(m, arg, rel_x, rel_y, rawestext);
+ return click_statuscmd_text(m, arg, a->rel_x, rawestext);
}
#endif // BAR_EXTRABAR_PATCH
int
-click_statuscmd_text(Monitor *m, Arg *arg, int rel_x, int rel_y, char *text)
+click_statuscmd_text(Monitor *m, Arg *arg, int rel_x, char *text)
{
int i = -1;
int x = 0;
diff --git a/patch/bar_statuscmd.h b/patch/bar_statuscmd.h
index 92ed7e1..7619ec3 100644
--- a/patch/bar_statuscmd.h
+++ b/patch/bar_statuscmd.h
@@ -1,6 +1,6 @@
-static int click_statuscmd(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h);
+static int click_statuscmd(Monitor *m, Arg *arg, BarClickArg *a);
#if BAR_EXTRABAR_PATCH
-static int click_statuscmd_eb(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h);
+static int click_statuscmd_eb(Monitor *m, Arg *arg, BarClickArg *a);
#endif // BAR_EXTRABAR_PATCH
-static int click_statuscmd_text(Monitor *m, Arg *arg, int rel_x, int rel_y, char *text);
+static int click_statuscmd_text(Monitor *m, 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 9938543..e9df765 100644
--- a/patch/bar_systray.c
+++ b/patch/bar_systray.c
@@ -5,7 +5,7 @@ static int systraybarrule = -1;
static int systrayxpos = 0;
int
-width_systray(Monitor *m, int max_width)
+width_systray(Monitor *m, BarWidthArg *a)
{
unsigned int w = 0;
Client *i;
@@ -17,15 +17,15 @@ width_systray(Monitor *m, int max_width)
}
int
-draw_systray(Monitor *m, int x_pos, int w)
+draw_systray(Monitor *m, BarDrawArg *a)
{
- systrayxpos = x_pos;
+ systrayxpos = a->x;
updatesystray();
- return systrayxpos + w;
+ return systrayxpos + a->w;
}
int
-click_systray(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_systray(Monitor *m, Arg *arg, BarClickArg *a)
{
return -1;
}
diff --git a/patch/bar_systray.h b/patch/bar_systray.h
index de588d1..5c4f387 100644
--- a/patch/bar_systray.h
+++ b/patch/bar_systray.h
@@ -26,9 +26,9 @@ struct Systray {
};
/* bar integration */
-static int width_systray(Monitor *m, int max_width);
-static int draw_systray(Monitor *m, int x_pos, int w);
-static int click_systray(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h);
+static int width_systray(Monitor *m, BarWidthArg *a);
+static int draw_systray(Monitor *m, BarDrawArg *a);
+static int click_systray(Monitor *m, Arg *arg, BarClickArg *a);
/* function declarations */
static Atom getatomprop(Client *c, Atom prop);
diff --git a/patch/bar_taggrid.c b/patch/bar_taggrid.c
index 4fa98d7..78b3d1c 100644
--- a/patch/bar_taggrid.c
+++ b/patch/bar_taggrid.c
@@ -1,11 +1,11 @@
int
-width_taggrid(Monitor *m, int max_width)
+width_taggrid(Monitor *m, BarWidthArg *a)
{
return (bh / 2) * (LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0));
}
int
-draw_taggrid(Monitor *m, int x_pos, int w)
+draw_taggrid(Monitor *m, BarDrawArg *a)
{
unsigned int x, y, h, max_x, columns, occ = 0;
int invert, i,j, k;
@@ -15,7 +15,7 @@ draw_taggrid(Monitor *m, int x_pos, int w)
occ |= c->tags;
h = bh / tagrows;
- x = max_x = x_pos;
+ x = max_x = a->x;
y = 0;
columns = LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0);
@@ -24,7 +24,7 @@ draw_taggrid(Monitor *m, int x_pos, int w)
/* We will draw LENGTH(tags) squares in tagraws raws. */
for (j = 0, i = 0; j < tagrows; j++) {
- x = x_pos;
+ x = a->x;
for (k = 0; k < columns && i < LENGTH(tags); k++, i++) {
invert = m->tagset[m->seltags] & 1 << i ? 0 : 1;
@@ -51,12 +51,12 @@ draw_taggrid(Monitor *m, int x_pos, int w)
}
int
-click_taggrid(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_taggrid(Monitor *m, Arg *arg, BarClickArg *a)
{
unsigned int i, columns;
columns = LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0);
- i = (rel_x - 0) / (bh / tagrows) + columns * (rel_y / (bh / tagrows));
+ i = (a->rel_x - 0) / (bh / tagrows) + columns * (a->rel_y / (bh / tagrows));
if (i >= LENGTH(tags)) {
i = LENGTH(tags) - 1;
}
diff --git a/patch/bar_taggrid.h b/patch/bar_taggrid.h
index ca8a16c..d284a07 100644
--- a/patch/bar_taggrid.h
+++ b/patch/bar_taggrid.h
@@ -1,4 +1,4 @@
-static int width_taggrid(Monitor *m, int max_width);
-static int draw_taggrid(Monitor *m, int x, int w);
-static int click_taggrid(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h);
+static int width_taggrid(Monitor *m, BarWidthArg *a);
+static int draw_taggrid(Monitor *m, BarDrawArg *a);
+static int click_taggrid(Monitor *m, Arg *arg, BarClickArg *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 73dc5d7..708e61d 100644
--- a/patch/bar_tags.c
+++ b/patch/bar_tags.c
@@ -1,5 +1,5 @@
int
-width_tags(Monitor *m, int max_width)
+width_tags(Monitor *m, BarWidthArg *a)
{
int w, i;
for (w = 0, i = 0; i < LENGTH(tags); i++) {
@@ -13,9 +13,10 @@ width_tags(Monitor *m, int max_width)
}
int
-draw_tags(Monitor *m, int x, int w)
+draw_tags(Monitor *m, BarDrawArg *a)
{
int invert;
+ int w, x = a->x;
#if BAR_ALTERNATIVE_TAGS_PATCH
int wdelta;
#endif // BAR_ALTERNATIVE_TAGS_PATCH
@@ -106,7 +107,7 @@ draw_tags(Monitor *m, int x, int w)
}
int
-click_tags(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_tags(Monitor *m, Arg *arg, BarClickArg *a)
{
int i = 0, x = 0;
do
@@ -115,7 +116,7 @@ click_tags(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
#else
x += TEXTW(tags[i]);
#endif
- while (rel_x >= x && ++i < LENGTH(tags));
+ while (a->rel_x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
arg->ui = 1 << i;
}
diff --git a/patch/bar_tags.h b/patch/bar_tags.h
index 788c488..9961f1a 100644
--- a/patch/bar_tags.h
+++ b/patch/bar_tags.h
@@ -1,3 +1,3 @@
-static int width_tags(Monitor *m, int max_width);
-static int draw_tags(Monitor *m, int x, int w);
-static int click_tags(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h); \ No newline at end of file
+static int width_tags(Monitor *m, BarWidthArg *a);
+static int draw_tags(Monitor *m, BarDrawArg *a);
+static int click_tags(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_vtcolors.c b/patch/bar_vtcolors.c
new file mode 100644
index 0000000..349970f
--- /dev/null
+++ b/patch/bar_vtcolors.c
@@ -0,0 +1,70 @@
+void
+get_vt_colors(void)
+{
+ char *cfs[3] = {
+ "/sys/module/vt/parameters/default_red",
+ "/sys/module/vt/parameters/default_grn",
+ "/sys/module/vt/parameters/default_blu",
+ };
+ char vtcs[16][8];
+ char tk[] = ",";
+ char cl[64];
+ char *tp = NULL;
+ FILE *fp;
+ size_t r;
+ int i, c, n;
+
+ for (i = 0; i < 16; i++)
+ strcpy(vtcs[i], "#000000");
+
+ for (i = 0, r = 0; i < 3; i++) {
+ if ((fp = fopen(cfs[i], "r")) == NULL)
+ continue;
+ while ((cl[r] = fgetc(fp)) != EOF && cl[r] != '\n')
+ r++;
+ cl[r] = '\0';
+ for (c = 0, tp = cl, n = 0; c < 16; c++, tp++) {
+ if ((r = strcspn(tp, tk)) == -1)
+ break;
+ for (n = 0; r && *tp >= 48 && *tp < 58; r--, tp++)
+ n = n * 10 - 48 + *tp;
+ vtcs[c][i * 2 + 1] = n / 16 < 10 ? n / 16 + 48 : n / 16 + 87;
+ vtcs[c][i * 2 + 2] = n % 16 < 10 ? n % 16 + 48 : n % 16 + 87;
+ }
+ fclose(fp);
+ }
+ for (i = 0; i < LENGTH(colors); i++) {
+ #if FLOAT_BORDER_COLOR_PATCH
+ for (c = 0; c < 4; c++)
+ #else
+ for (c = 0; c < 3; c++)
+ #endif // FLOAT_BORDER_COLOR_PATCH
+ {
+ n = color_ptrs[i][c];
+ if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n]))
+ memcpy(colors[i][c], vtcs[n], 7);
+ }
+ }
+}
+
+int get_luminance(char *r)
+{
+ char *c = r;
+ int n[3] = {0};
+ int i = 0;
+
+ while (*c) {
+ if (*c >= 48 && *c < 58)
+ n[i / 2] = n[i / 2] * 16 - 48 + *c;
+ else if (*c >= 65 && *c < 71)
+ n[i / 2] = n[i / 2] * 16 - 55 + *c;
+ else if (*c >= 97 && *c < 103)
+ n[i / 2] = n[i / 2] * 16 - 87 + *c;
+ else
+ i--;
+ i++;
+ c++;
+ }
+
+ return (0.299 * n[0] + 0.587 * n[1] + 0.114 * n[2]) / 2.55;
+} \ No newline at end of file
diff --git a/patch/bar_vtcolors.h b/patch/bar_vtcolors.h
new file mode 100644
index 0000000..7341e6a
--- /dev/null
+++ b/patch/bar_vtcolors.h
@@ -0,0 +1,2 @@
+static void get_vt_colors(void);
+static int get_luminance(char *rgb); \ No newline at end of file
diff --git a/patch/bar_wintitle.c b/patch/bar_wintitle.c
index e937723..36889c1 100644
--- a/patch/bar_wintitle.c
+++ b/patch/bar_wintitle.c
@@ -1,11 +1,11 @@
int
-width_wintitle(Monitor *m, int max_width)
+width_wintitle(Monitor *m, BarWidthArg *a)
{
- return max_width;
+ return a->max_width;
}
int
-draw_wintitle(Monitor *m, int x, int w)
+draw_wintitle(Monitor *m, BarDrawArg *a)
{
#if !BAR_ACTIVETAGINDICATORBAR_PATCH && !BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
#if BAR_PANGO_PATCH
@@ -19,6 +19,7 @@ draw_wintitle(Monitor *m, int x, int w)
#else
int boxw = drw->fonts->h / 6 + 2;
#endif // BAR_PANGO_PATCH
+ int x = a->x, w = a->w;
if (m->sel) {
#if BAR_VTCOLORS_PATCH
@@ -33,25 +34,17 @@ draw_wintitle(Monitor *m, int x, int w)
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
#if BAR_CENTEREDWINDOWNAME_PATCH
int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x;
- #if BAR_PADDING_PATCH && BAR_PANGO_PATCH
- drw_text(drw, x, 0, w - 2*sp, bh, mid, m->sel->name, 0, False);
- #elif BAR_PADDING_PATCH
- drw_text(drw, x, 0, w - 2*sp, bh, mid, m->sel->name, 0);
- #elif BAR_PANGO_PATCH
+ #if BAR_PANGO_PATCH
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0, False);
#else
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
- #endif // BAR_PADDING_PATCH
+ #endif // BAR_PANGO_PATCH
#else
- #if BAR_PADDING_PATCH && BAR_PANGO_PATCH
- drw_text(drw, x, 0, w - 2*sp, bh, lrpad / 2, m->sel->name, 0, False);
- #elif BAR_PADDING_PATCH
- drw_text(drw, x, 0, w - 2*sp, bh, lrpad / 2, m->sel->name, 0);
- #elif BAR_PANGO_PATCH
+ #if BAR_PANGO_PATCH
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False);
#else
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
- #endif // BAR_PADDING_PATCH
+ #endif // BAR_PANGO_PATCH
#endif // BAR_CENTEREDWINDOWNAME_PATCH
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
XSync(dpy, False);
@@ -61,7 +54,7 @@ draw_wintitle(Monitor *m, int x, int w)
#if BAR_ACTIVETAGINDICATORBAR_PATCH
drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, m->sel->isfixed, 0);
#elif BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
- drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2,
+ drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, 0);
#else
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
#endif // BAR_ACTIVETAGINDICATORBAR_PATCH
@@ -71,17 +64,13 @@ draw_wintitle(Monitor *m, int x, int w)
#else
drw_setscheme(drw, scheme[SchemeNorm]);
#endif // BAR_VTCOLORS_PATCH
- #if BAR_PADDING_PATCH
- drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
- #else
drw_rect(drw, x, 0, w, bh, 1, 1);
- #endif // BAR_PADDING_PATCH
}
return x + w;
}
int
-click_wintitle(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h)
+click_wintitle(Monitor *m, Arg *arg, BarClickArg *a)
{
return ClkWinTitle;
}
diff --git a/patch/bar_wintitle.h b/patch/bar_wintitle.h
index b1d7ddd..d79affe 100644
--- a/patch/bar_wintitle.h
+++ b/patch/bar_wintitle.h
@@ -1,3 +1,3 @@
-static int width_wintitle(Monitor *m, int max_width);
-static int draw_wintitle(Monitor *m, int x, int w);
-static int click_wintitle(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h); \ No newline at end of file
+static int width_wintitle(Monitor *m, BarWidthArg *a);
+static int draw_wintitle(Monitor *m, BarDrawArg *a);
+static int click_wintitle(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file