A mirror of phillbush's xmenu.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

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