2020-07-15 06:57:30 +00:00
|
|
|
#if !BAR_DWMBLOCKS_PATCH
|
|
|
|
static const char statusexport[] = "export BUTTON=-;";
|
|
|
|
static int statuscmdn;
|
2021-04-14 09:23:18 +00:00
|
|
|
static char lastbutton[] = "-";
|
2020-07-15 06:57:30 +00:00
|
|
|
#endif // BAR_DWMBLOCKS_PATCH
|
|
|
|
|
|
|
|
int
|
2020-09-09 15:24:02 +00:00
|
|
|
click_statuscmd(Bar *bar, Arg *arg, BarArg *a)
|
2020-07-15 06:57:30 +00:00
|
|
|
{
|
2020-09-09 15:24:02 +00:00
|
|
|
return click_statuscmd_text(arg, a->x, rawstext);
|
2020-07-15 06:57:30 +00:00
|
|
|
}
|
|
|
|
|
2020-07-18 19:12:30 +00:00
|
|
|
#if BAR_EXTRASTATUS_PATCH
|
2020-07-15 06:57:30 +00:00
|
|
|
int
|
2020-09-09 15:24:02 +00:00
|
|
|
click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a)
|
2020-07-15 06:57:30 +00:00
|
|
|
{
|
2020-09-09 15:24:02 +00:00
|
|
|
return click_statuscmd_text(arg, a->x, rawestext);
|
2020-07-15 06:57:30 +00:00
|
|
|
}
|
2020-07-18 19:12:30 +00:00
|
|
|
#endif // BAR_EXTRASTATUS_PATCH
|
2020-07-15 06:57:30 +00:00
|
|
|
|
|
|
|
int
|
2020-07-18 11:03:30 +00:00
|
|
|
click_statuscmd_text(Arg *arg, int rel_x, char *text)
|
2020-07-15 06:57:30 +00:00
|
|
|
{
|
|
|
|
int i = -1;
|
|
|
|
int x = 0;
|
|
|
|
char ch;
|
|
|
|
#if BAR_DWMBLOCKS_PATCH
|
2021-04-14 08:42:52 +00:00
|
|
|
statussig = -1;
|
2020-07-15 06:57:30 +00:00
|
|
|
#else
|
|
|
|
statuscmdn = 0;
|
|
|
|
#endif // BAR_DWMBLOCKS_PATCH
|
|
|
|
while (text[++i]) {
|
|
|
|
if ((unsigned char)text[i] < ' ') {
|
2021-08-25 10:18:01 +00:00
|
|
|
#if BAR_STATUSCOLORS_PATCH
|
|
|
|
if (text[i] < 17)
|
|
|
|
continue;
|
|
|
|
#endif // BAR_STATUSCOLORS_PATCH
|
2020-07-15 06:57:30 +00:00
|
|
|
ch = text[i];
|
|
|
|
text[i] = '\0';
|
2021-08-25 10:18:01 +00:00
|
|
|
#if BAR_STATUS2D_PATCH && !BAR_STATUSCOLORS_PATCH
|
2020-07-15 06:57:30 +00:00
|
|
|
x += status2dtextlength(text);
|
|
|
|
#else
|
2020-08-22 18:31:17 +00:00
|
|
|
x += TEXTWM(text) - lrpad;
|
|
|
|
#endif // BAR_STATUS2D_PATCH
|
2020-07-15 06:57:30 +00:00
|
|
|
text[i] = ch;
|
|
|
|
text += i+1;
|
|
|
|
i = -1;
|
|
|
|
#if BAR_DWMBLOCKS_PATCH
|
2021-04-14 08:42:52 +00:00
|
|
|
if (x >= rel_x && statussig != -1)
|
2020-07-15 06:57:30 +00:00
|
|
|
break;
|
2021-04-14 08:42:52 +00:00
|
|
|
statussig = ch;
|
2020-07-15 06:57:30 +00:00
|
|
|
#else
|
|
|
|
if (x >= rel_x)
|
|
|
|
break;
|
|
|
|
if (ch <= LENGTH(statuscmds))
|
2021-04-14 09:23:18 +00:00
|
|
|
statuscmdn = ch;
|
2020-07-15 06:57:30 +00:00
|
|
|
#endif // BAR_DWMBLOCKS_PATCH
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if BAR_DWMBLOCKS_PATCH
|
2021-04-14 08:42:52 +00:00
|
|
|
if (statussig == -1)
|
|
|
|
statussig = 0;
|
2020-07-15 06:57:30 +00:00
|
|
|
#endif // BAR_DWMBLOCKS_PATCH
|
|
|
|
return ClkStatusText;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
copyvalidchars(char *text, char *rawtext)
|
|
|
|
{
|
|
|
|
int i = -1, j = 0;
|
|
|
|
|
|
|
|
while (rawtext[++i]) {
|
|
|
|
if ((unsigned char)rawtext[i] >= ' ') {
|
|
|
|
text[j++] = rawtext[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
text[j] = '\0';
|
|
|
|
}
|
2021-06-14 05:16:17 +00:00
|
|
|
|