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.
 
 
 
 
 
 

50 lines
1.2 KiB

  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include "config.h"
  6. #include <X11/Xlib.h>
  7. #include <X11/Xlocale.h>
  8. #define SPACE 30 /* px */
  9. /* color */
  10. enum { ColFG, ColBG, ColLast };
  11. typedef struct DC DC;
  12. typedef struct Fnt Fnt;
  13. struct Fnt {
  14. XFontStruct *xfont;
  15. XFontSet set;
  16. int ascent;
  17. int descent;
  18. int height;
  19. };
  20. struct DC {
  21. int x, y, w, h;
  22. unsigned long norm[ColLast];
  23. unsigned long sel[ColLast];
  24. Drawable drawable;
  25. Fnt font;
  26. GC gc;
  27. }; /* draw context */
  28. extern int screen;
  29. extern Display *dpy;
  30. extern DC dc; /* global drawing context */
  31. /* draw.c */
  32. extern void drawtext(const char *text,
  33. unsigned long col[ColLast]); /* draws text with the defined color tuple */
  34. extern unsigned long getcolor(const char *colstr); /* returns color of colstr */
  35. extern void setfont(const char *fontstr); /* sets global font */
  36. extern unsigned int textw(const char *text); /* returns width of text in px */
  37. /* util.c */
  38. extern void *emalloc(unsigned int size); /* allocates memory, exits on error */
  39. extern void eprint(const char *errstr, ...); /* prints errstr and exits with 1 */
  40. extern char *estrdup(const char *str); /* duplicates str, exits on allocation error */