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