A mirror of phillbush's xmenu.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

82 satır
2.3 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. /* 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 computed by xmenu */
  33. int iconsize;
  34. int posx, posy; /* cursor position */
  35. int screenw, screenh; /* screen width and height */
  36. };
  37. /* draw context structure */
  38. struct DC {
  39. XftColor normal[ColorLast];
  40. XftColor selected[ColorLast];
  41. XftColor border;
  42. XftColor separator;
  43. GC gc;
  44. XftFont *font;
  45. };
  46. /* menu item structure */
  47. struct Item {
  48. char *label; /* string to be drawed on menu */
  49. char *output; /* string to be outputed when item is clicked */
  50. char *file; /* filename of the icon */
  51. int y; /* item y position relative to menu */
  52. int h; /* item height */
  53. size_t labellen; /* strlen(label) */
  54. struct Item *prev; /* previous item */
  55. struct Item *next; /* next item */
  56. struct Menu *submenu; /* submenu spawned by clicking on item */
  57. Drawable sel, unsel; /* pixmap for selected and unselected icons */
  58. Imlib_Image icon;
  59. };
  60. /* menu structure */
  61. struct Menu {
  62. struct Menu *parent; /* parent menu */
  63. struct Item *caller; /* item that spawned the menu */
  64. struct Item *list; /* list of items contained by the menu */
  65. struct Item *selected; /* item currently selected in the menu */
  66. int x, y, w, h; /* menu geometry */
  67. unsigned level; /* menu level relative to root */
  68. Drawable pixmap; /* pixmap to draw the menu on */
  69. XftDraw *draw;
  70. Window win; /* menu window to map on the screen */
  71. };