A mirror of phillbush's xmenu.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

91 Zeilen
2.5 KiB

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