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.

66 lines
1.7 KiB

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. typedef struct {
  3. Cursor cursor;
  4. } Cur;
  5. typedef struct Fnt {
  6. Display *dpy;
  7. unsigned int h;
  8. XftFont *xfont;
  9. FcPattern *pattern;
  10. struct Fnt *next;
  11. } Fnt;
  12. enum { ColFg, ColBg, ColBorder, ColFloat, ColCount }; /* Clr scheme index */
  13. typedef XftColor Clr;
  14. typedef struct {
  15. unsigned int w, h;
  16. Display *dpy;
  17. int screen;
  18. Window root;
  19. Drawable drawable;
  20. GC gc;
  21. Clr *scheme;
  22. Fnt *fonts;
  23. } Drw;
  24. /* Drawable abstraction */
  25. Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
  26. void drw_resize(Drw *drw, unsigned int w, unsigned int h);
  27. void drw_free(Drw *drw);
  28. /* Fnt abstraction */
  29. Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
  30. void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
  31. void drw_fontset_free(Fnt* set);
  32. unsigned int drw_fontset_getwidth(Drw *drw, const char *text, Bool markup);
  33. /* Colorscheme abstraction */
  34. void drw_clr_create(
  35. Drw *drw,
  36. Clr *dest,
  37. const char *clrname
  38. );
  39. Clr *drw_scm_create(
  40. Drw *drw,
  41. char *clrnames[],
  42. size_t clrcount
  43. );
  44. /* Cursor abstraction */
  45. Cur *drw_cur_create(Drw *drw, int shape);
  46. void drw_cur_free(Drw *drw, Cur *cursor);
  47. /* Drawing context manipulation */
  48. void drw_setfontset(Drw *drw, Fnt *set);
  49. void drw_setscheme(Drw *drw, Clr *scm);
  50. /* Drawing functions */
  51. void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
  52. 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);
  53. /* Map functions */
  54. void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);