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 { |
05cfe1a0 |
20 | /* the values below are set by config.h */ |
8902c43b |
21 | const char *font; |
8902c43b |
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; |
8902c43b |
28 | int width_pixels; |
29 | int height_pixels; |
30 | int border_pixels; |
31 | int separator_pixels; |
32 | int gap_pixels; |
8902c43b |
33 | int triangle_width; |
34 | int triangle_height; |
8902c43b |
35 | int iconpadding; |
71b4db92 |
36 | int horzpadding; |
37 | |
05cfe1a0 |
38 | /* the values below are computed by xmenu */ |
71b4db92 |
39 | int iconsize; |
05cfe1a0 |
40 | int posx, posy; /* cursor position */ |
8902c43b |
41 | int screenw, screenh; /* screen width and height */ |
42 | }; |
43 | |
44 | /* draw context structure */ |
45 | struct DC { |
46 | XftColor normal[ColorLast]; |
47 | XftColor selected[ColorLast]; |
48 | XftColor border; |
49 | XftColor separator; |
50 | |
51 | GC gc; |
52 | XftFont *font; |
53 | }; |
54 | |
55 | /* menu item structure */ |
56 | struct Item { |
57 | char *label; /* string to be drawed on menu */ |
58 | char *output; /* string to be outputed when item is clicked */ |
59 | char *file; /* filename of the icon */ |
60 | int y; /* item y position relative to menu */ |
61 | int h; /* item height */ |
62 | size_t labellen; /* strlen(label) */ |
63 | struct Item *prev; /* previous item */ |
64 | struct Item *next; /* next item */ |
65 | struct Menu *submenu; /* submenu spawned by clicking on item */ |
675a2008 |
66 | Drawable sel, unsel; /* pixmap for selected and unselected icons */ |
8902c43b |
67 | Imlib_Image icon; |
68 | }; |
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 | unsigned level; /* menu level relative to root */ |
78 | Drawable pixmap; /* pixmap to draw the menu on */ |
79 | XftDraw *draw; |
80 | Window win; /* menu window to map on the screen */ |
81 | }; |