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.

102 lines
2.9 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. /* See LICENSE file for copyright and license details. */
  2. #if BAR_PANGO_PATCH
  3. #include <pango/pango.h>
  4. #include <pango/pangoxft.h>
  5. #endif // BAR_PANGO_PATCH
  6. typedef struct {
  7. Cursor cursor;
  8. } Cur;
  9. typedef struct Fnt {
  10. Display *dpy;
  11. unsigned int h;
  12. #if BAR_PANGO_PATCH
  13. PangoLayout *layout;
  14. #else
  15. XftFont *xfont;
  16. FcPattern *pattern;
  17. struct Fnt *next;
  18. #endif // BAR_PANGO_PATCH
  19. } Fnt;
  20. enum { ColFg, ColBg, ColBorder, ColFloat, ColCount }; /* Clr scheme index */
  21. typedef XftColor Clr;
  22. typedef struct {
  23. unsigned int w, h;
  24. Display *dpy;
  25. int screen;
  26. Window root;
  27. #if BAR_ALPHA_PATCH
  28. Visual *visual;
  29. unsigned int depth;
  30. Colormap cmap;
  31. #endif // BAR_ALPHA_PATCH
  32. Drawable drawable;
  33. GC gc;
  34. Clr *scheme;
  35. Fnt *fonts;
  36. } Drw;
  37. /* Drawable abstraction */
  38. #if BAR_ALPHA_PATCH
  39. Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
  40. #else
  41. Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
  42. #endif // BAR_ALPHA_PATCH
  43. void drw_resize(Drw *drw, unsigned int w, unsigned int h);
  44. void drw_free(Drw *drw);
  45. /* Fnt abstraction */
  46. #if BAR_PANGO_PATCH
  47. Fnt *drw_font_create(Drw* drw, const char font[]);
  48. void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup);
  49. #else
  50. Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
  51. void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
  52. #endif // BAR_PANGO_PATCH
  53. void drw_fontset_free(Fnt* set);
  54. unsigned int drw_fontset_getwidth(Drw *drw, const char *text, Bool markup);
  55. /* Colorscheme abstraction */
  56. void drw_clr_create(
  57. Drw *drw,
  58. Clr *dest,
  59. const char *clrname
  60. #if BAR_ALPHA_PATCH
  61. , unsigned int alpha
  62. #endif // BAR_ALPHA_PATCH
  63. );
  64. Clr *drw_scm_create(
  65. Drw *drw,
  66. char *clrnames[],
  67. #if BAR_ALPHA_PATCH
  68. const unsigned int alphas[],
  69. #endif // BAR_ALPHA_PATCH
  70. size_t clrcount
  71. );
  72. /* Cursor abstraction */
  73. Cur *drw_cur_create(Drw *drw, int shape);
  74. void drw_cur_free(Drw *drw, Cur *cursor);
  75. /* Drawing context manipulation */
  76. #if !BAR_PANGO_PATCH
  77. void drw_setfontset(Drw *drw, Fnt *set);
  78. #endif // BAR_PANGO_PATCH
  79. void drw_setscheme(Drw *drw, Clr *scm);
  80. #if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
  81. void drw_settrans(Drw *drw, Clr *psc, Clr *nsc);
  82. #endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
  83. /* Drawing functions */
  84. void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
  85. int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup);
  86. #if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
  87. void drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash);
  88. #endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
  89. /* Map functions */
  90. void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);