Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.4 KiB

  1. #if !BAR_DWMBLOCKS_PATCH
  2. static const char statusexport[] = "export BUTTON=-;";
  3. static int statuscmdn;
  4. static int lastbutton;
  5. #endif // BAR_DWMBLOCKS_PATCH
  6. int
  7. click_statuscmd(Bar *bar, Arg *arg, BarArg *a)
  8. {
  9. return click_statuscmd_text(arg, a->x, rawstext);
  10. }
  11. #if BAR_EXTRASTATUS_PATCH
  12. int
  13. click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a)
  14. {
  15. return click_statuscmd_text(arg, a->x, rawestext);
  16. }
  17. #endif // BAR_EXTRASTATUS_PATCH
  18. int
  19. click_statuscmd_text(Arg *arg, int rel_x, char *text)
  20. {
  21. int i = -1;
  22. int x = 0;
  23. char ch;
  24. #if BAR_DWMBLOCKS_PATCH
  25. dwmblockssig = -1;
  26. #else
  27. statuscmdn = 0;
  28. #endif // BAR_DWMBLOCKS_PATCH
  29. while (text[++i]) {
  30. if ((unsigned char)text[i] < ' ') {
  31. ch = text[i];
  32. text[i] = '\0';
  33. #if BAR_STATUS2D_PATCH && !BAR_BAR_STATUSCOLORS_PATCH
  34. x += status2dtextlength(text);
  35. #else
  36. x += TEXTWM(text) - lrpad;
  37. #endif // BAR_STATUS2D_PATCH
  38. text[i] = ch;
  39. text += i+1;
  40. i = -1;
  41. #if BAR_DWMBLOCKS_PATCH
  42. if (x >= rel_x && dwmblockssig != -1)
  43. break;
  44. dwmblockssig = ch;
  45. #else
  46. if (x >= rel_x)
  47. break;
  48. if (ch <= LENGTH(statuscmds))
  49. statuscmdn = ch - 1;
  50. #endif // BAR_DWMBLOCKS_PATCH
  51. }
  52. }
  53. #if BAR_DWMBLOCKS_PATCH
  54. if (dwmblockssig == -1)
  55. dwmblockssig = 0;
  56. #endif // BAR_DWMBLOCKS_PATCH
  57. return ClkStatusText;
  58. }
  59. void
  60. copyvalidchars(char *text, char *rawtext)
  61. {
  62. int i = -1, j = 0;
  63. while (rawtext[++i]) {
  64. if ((unsigned char)rawtext[i] >= ' ') {
  65. text[j++] = rawtext[i];
  66. }
  67. }
  68. text[j] = '\0';
  69. }