My dmenu build
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.
 
 
 
 
 
 

75 lines
1.6 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 *, int, Window, unsigned int, unsigned int);
  40. void drw_resize(Drw *, unsigned int, unsigned int);
  41. void drw_free(Drw *);
  42. /* Fnt abstraction */
  43. Fnt *drw_font_create(Drw *, const char *);
  44. void drw_load_fonts(Drw *, const char *[], size_t);
  45. void drw_font_free(Fnt *);
  46. void drw_font_getexts(Fnt *, const char *, unsigned int, Extnts *);
  47. unsigned int drw_font_getexts_width(Fnt *, const char *, unsigned int);
  48. /* Colour abstraction */
  49. Clr *drw_clr_create(Drw *, const char *);
  50. void drw_clr_free(Clr *);
  51. /* Cursor abstraction */
  52. Cur *drw_cur_create(Drw *, int);
  53. void drw_cur_free(Drw *, Cur *);
  54. /* Drawing context manipulation */
  55. void drw_setfont(Drw *, Fnt *);
  56. void drw_setscheme(Drw *, ClrScheme *);
  57. /* Drawing functions */
  58. void drw_rect(Drw *, int, int, unsigned int, unsigned int, int, int, int);
  59. int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *, int);
  60. /* Map functions */
  61. void drw_map(Drw *, Window, int, int, unsigned int, unsigned int);