A mirror of phillbush's xmenu.
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.
 
 
 
 
 

81 lines
2.1 KiB

  1. #define PROGNAME "xmenu"
  2. /* macros for keyboard menu navigation */
  3. #define ITEMPREV 0
  4. #define ITEMNEXT 1
  5. /* macros */
  6. #define LEN(x) (sizeof (x) / sizeof (x[0]))
  7. #define MAX(x,y) ((x)>(y)?(x):(y))
  8. #define MIN(x,y) ((x)<(y)?(x):(y))
  9. /* color enum */
  10. enum {ColorFG, ColorBG, ColorLast};
  11. /* EWMH atoms */
  12. enum {NetWMName, NetWMWindowType, NetWMWindowTypePopupMenu, NetLast};
  13. /* configuration structure */
  14. struct Config {
  15. const char *font;
  16. const char *background_color;
  17. const char *foreground_color;
  18. const char *selbackground_color;
  19. const char *selforeground_color;
  20. const char *separator_color;
  21. const char *border_color;
  22. int width_pixels;
  23. int height_pixels;
  24. int border_pixels;
  25. int separator_pixels;
  26. int gap_pixels;
  27. int triangle_width;
  28. int triangle_height;
  29. int iconpadding;
  30. int cursx, cursy; /* cursor position */
  31. int screenw, screenh; /* screen width and height */
  32. };
  33. /* draw context structure */
  34. struct DC {
  35. XftColor normal[ColorLast];
  36. XftColor selected[ColorLast];
  37. XftColor border;
  38. XftColor separator;
  39. GC gc;
  40. XftFont *font;
  41. };
  42. /* menu item structure */
  43. struct Item {
  44. char *label; /* string to be drawed on menu */
  45. char *output; /* string to be outputed when item is clicked */
  46. char *file; /* filename of the icon */
  47. int y; /* item y position relative to menu */
  48. int h; /* item height */
  49. size_t labellen; /* strlen(label) */
  50. struct Item *prev; /* previous item */
  51. struct Item *next; /* next item */
  52. struct Menu *submenu; /* submenu spawned by clicking on item */
  53. Imlib_Image icon;
  54. };
  55. /* menu structure */
  56. struct Menu {
  57. struct Menu *parent; /* parent menu */
  58. struct Item *caller; /* item that spawned the menu */
  59. struct Item *list; /* list of items contained by the menu */
  60. struct Item *selected; /* item currently selected in the menu */
  61. int x, y, w, h; /* menu geometry */
  62. unsigned level; /* menu level relative to root */
  63. Drawable pixmap; /* pixmap to draw the menu on */
  64. XftDraw *draw;
  65. Window win; /* menu window to map on the screen */
  66. };