Configuration file for DWM on MacBook Air
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.8 KiB

  1. /* See LICENSE file for copyright and license details. */
  2. #define DRW_FONT_CACHE_SIZE 32
  3. typedef struct {
  4. unsigned long pix;
  5. XftColor rgb;
  6. } Clr;
  7. typedef struct {
  8. Cursor cursor;
  9. } Cur;
  10. typedef struct {
  11. Display *dpy;
  12. int ascent;
  13. int descent;
  14. unsigned int h;
  15. XftFont *xfont;
  16. FcPattern *pattern;
  17. } Fnt;
  18. typedef struct {
  19. Clr *fg;
  20. Clr *bg;
  21. Clr *border;
  22. } ClrScheme;
  23. typedef struct {
  24. unsigned int w, h;
  25. Display *dpy;
  26. int screen;
  27. Window root;
  28. Drawable drawable;
  29. GC gc;
  30. ClrScheme *scheme;
  31. size_t fontcount;
  32. Fnt *fonts[DRW_FONT_CACHE_SIZE];
  33. } Drw;
  34. typedef struct {
  35. unsigned int w;
  36. unsigned int h;
  37. } Extnts;
  38. /* Drawable abstraction */
  39. Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
  40. void drw_resize(Drw *drw, unsigned int w, unsigned int h);
  41. void drw_free(Drw *drw);
  42. /* Fnt abstraction */
  43. Fnt *drw_font_create(Drw *drw, const char *fontname);
  44. void drw_load_fonts(Drw* drw, const char *fonts[], size_t fontcount);
  45. void drw_font_free(Fnt *font);
  46. void drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *extnts);
  47. unsigned int drw_font_getexts_width(Fnt *font, const char *text, unsigned int len);
  48. /* Colour abstraction */
  49. Clr *drw_clr_create(Drw *drw, const char *clrname);
  50. void drw_clr_free(Clr *clr);
  51. /* Cursor abstraction */
  52. Cur *drw_cur_create(Drw *drw, int shape);
  53. void drw_cur_free(Drw *drw, Cur *cursor);
  54. /* Drawing context manipulation */
  55. void drw_setfont(Drw *drw, Fnt *font);
  56. void drw_setscheme(Drw *drw, ClrScheme *scheme);
  57. /* Drawing functions */
  58. void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert);
  59. int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert);
  60. /* Map functions */
  61. void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);