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.
 
 
 
 
 
 

55 lines
1.4 KiB

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