8902c43b |
1 | #define PROGNAME "xmenu" |
2 | |
006c94ce |
3 | /* enum for keyboard menu navigation */ |
4 | enum { ITEMPREV, ITEMNEXT, ITEMFIRST, ITEMLAST }; |
8902c43b |
5 | |
6 | /* macros */ |
cdeaefaa |
7 | #define LEN(x) (sizeof (x) / sizeof (x[0])) |
8 | #define MAX(x,y) ((x)>(y)?(x):(y)) |
9 | #define MIN(x,y) ((x)<(y)?(x):(y)) |
10 | #define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) |
8902c43b |
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 | |
237da982 |
38 | /* the values below are set by options */ |
39 | int monitor; |
40 | int posx, posy; /* rootmenu position */ |
41 | |
42 | /* the value below is computed by xmenu */ |
71b4db92 |
43 | int iconsize; |
8902c43b |
44 | }; |
45 | |
46 | /* draw context structure */ |
47 | struct DC { |
48 | XftColor normal[ColorLast]; |
49 | XftColor selected[ColorLast]; |
50 | XftColor border; |
51 | XftColor separator; |
52 | |
53 | GC gc; |
cdeaefaa |
54 | |
0b0faa5f |
55 | FcPattern *pattern; |
cdeaefaa |
56 | XftFont **fonts; |
57 | size_t nfonts; |
8902c43b |
58 | }; |
59 | |
60 | /* menu item structure */ |
61 | struct Item { |
62 | char *label; /* string to be drawed on menu */ |
63 | char *output; /* string to be outputed when item is clicked */ |
64 | char *file; /* filename of the icon */ |
65 | int y; /* item y position relative to menu */ |
66 | int h; /* item height */ |
8902c43b |
67 | struct Item *prev; /* previous item */ |
68 | struct Item *next; /* next item */ |
69 | struct Menu *submenu; /* submenu spawned by clicking on item */ |
cdeaefaa |
70 | Drawable sel, unsel; /* pixmap for selected and unselected item */ |
8902c43b |
71 | Imlib_Image icon; |
72 | }; |
73 | |
b1cf3ebd |
74 | /* monitor geometry structure */ |
237da982 |
75 | struct Monitor { |
76 | int x, y, w, h; /* monitor geometry */ |
77 | }; |
78 | |
8902c43b |
79 | /* menu structure */ |
80 | struct Menu { |
81 | struct Menu *parent; /* parent menu */ |
82 | struct Item *caller; /* item that spawned the menu */ |
83 | struct Item *list; /* list of items contained by the menu */ |
84 | struct Item *selected; /* item currently selected in the menu */ |
85 | int x, y, w, h; /* menu geometry */ |
a2ff706d |
86 | int hasicon; /* whether the menu has item with icons */ |
3d853664 |
87 | int drawn; /* whether the menu was already drawn */ |
8902c43b |
88 | unsigned level; /* menu level relative to root */ |
8902c43b |
89 | Window win; /* menu window to map on the screen */ |
90 | }; |