Adding BarWidthArg, BarDrawArg, BarClickArg to keep the method signatures static
This commit is contained in:
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
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);
|
@ -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;
|
||||
}
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
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);
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
@ -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);
|
||||
}
|
@ -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);
|
||||
static int width_status2d_eb(Monitor *m, BarWidthArg *a);
|
||||
static int draw_status2d_eb(Monitor *m, BarDrawArg *a);
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
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);
|
@ -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;
|
||||
|
@ -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);
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
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);
|
70
patch/bar_vtcolors.c
Normal file
70
patch/bar_vtcolors.c
Normal file
@ -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;
|
||||
}
|
2
patch/bar_vtcolors.h
Normal file
2
patch/bar_vtcolors.h
Normal file
@ -0,0 +1,2 @@
|
||||
static void get_vt_colors(void);
|
||||
static int get_luminance(char *rgb);
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
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);
|
Reference in New Issue
Block a user