A mirror of phillbush's xmenu.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

97 wiersze
2.7 KiB

  1. #define PROGNAME "xmenu"
  2. /* enum for keyboard menu navigation */
  3. enum { ITEMPREV, ITEMNEXT, ITEMFIRST, ITEMLAST };
  4. /* enum for text alignment */
  5. enum {LeftAlignment, CenterAlignment, RightAlignment};
  6. /* macros */
  7. #define LEN(x) (sizeof (x) / sizeof (x[0]))
  8. #define MAX(x,y) ((x)>(y)?(x):(y))
  9. #define MIN(x,y) ((x)<(y)?(x):(y))
  10. #define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
  11. /* color enum */
  12. enum {ColorFG, ColorBG, ColorLast};
  13. /* EWMH atoms */
  14. enum {NetWMName, NetWMWindowType, NetWMWindowTypePopupMenu, NetLast};
  15. /* configuration structure */
  16. struct Config {
  17. /* the values below are set by config.h */
  18. const char *font;
  19. const char *background_color;
  20. const char *foreground_color;
  21. const char *selbackground_color;
  22. const char *selforeground_color;
  23. const char *separator_color;
  24. const char *border_color;
  25. int width_pixels;
  26. int height_pixels;
  27. int border_pixels;
  28. int separator_pixels;
  29. int gap_pixels;
  30. int triangle_width;
  31. int triangle_height;
  32. int iconpadding;
  33. int horzpadding;
  34. int alignment;
  35. /* the values below are set by options */
  36. int monitor;
  37. int posx, posy; /* rootmenu position */
  38. /* the value below is computed by xmenu */
  39. int iconsize;
  40. };
  41. /* draw context structure */
  42. struct DC {
  43. XftColor normal[ColorLast];
  44. XftColor selected[ColorLast];
  45. XftColor border;
  46. XftColor separator;
  47. GC gc;
  48. FcPattern *pattern;
  49. XftFont **fonts;
  50. size_t nfonts;
  51. };
  52. /* menu item structure */
  53. struct Item {
  54. char *label; /* string to be drawed on menu */
  55. char *output; /* string to be outputed when item is clicked */
  56. char *file; /* filename of the icon */
  57. int y; /* item y position relative to menu */
  58. int h; /* item height */
  59. int textw; /* text width */
  60. struct Item *prev; /* previous item */
  61. struct Item *next; /* next item */
  62. struct Menu *submenu; /* submenu spawned by clicking on item */
  63. Drawable sel, unsel; /* pixmap for selected and unselected item */
  64. Imlib_Image icon;
  65. };
  66. /* monitor geometry structure */
  67. struct Monitor {
  68. int x, y, w, h; /* monitor geometry */
  69. };
  70. /* menu structure */
  71. struct Menu {
  72. struct Menu *parent; /* parent menu */
  73. struct Item *caller; /* item that spawned the menu */
  74. struct Item *list; /* list of items contained by the menu */
  75. struct Item *selected; /* item currently selected in the menu */
  76. int x, y, w, h; /* menu geometry */
  77. int hasicon; /* whether the menu has item with icons */
  78. int drawn; /* whether the menu was already drawn */
  79. int maxtextw; /* maximum text width */
  80. unsigned level; /* menu level relative to root */
  81. Window win; /* menu window to map on the screen */
  82. };