fix missing assignment
[xmenu] / xmenu.h
... / ...
CommitLineData
1#define PROGNAME "xmenu"
2
3/* Actions for the main loop */
4#define ACTION_NOP 0
5#define ACTION_CLEAR 1<<0 /* clear text */
6#define ACTION_SELECT 1<<1 /* select item */
7#define ACTION_MAP 1<<2 /* remap menu windows */
8#define ACTION_DRAW 1<<3 /* redraw menu windows */
9
10/* enum for keyboard menu navigation */
11enum { ITEMPREV, ITEMNEXT, ITEMFIRST, ITEMLAST };
12
13/* enum for text alignment */
14enum {LeftAlignment, CenterAlignment, RightAlignment};
15
16/* macros */
17#define LEN(x) (sizeof (x) / sizeof (x[0]))
18#define MAX(x,y) ((x)>(y)?(x):(y))
19#define MIN(x,y) ((x)<(y)?(x):(y))
20#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
21#define GETNUM(n, s) { \
22 unsigned long __TMP__; \
23 if ((__TMP__ = strtoul((s), NULL, 10)) < INT_MAX) \
24 (n) = __TMP__; \
25 }
26
27/* color enum */
28enum {ColorFG, ColorBG, ColorLast};
29
30/* EWMH atoms */
31enum {NetWMName, NetWMWindowType, NetWMWindowTypePopupMenu, NetLast};
32
33/* configuration structure */
34struct Config {
35 /* the values below are set by config.h */
36 const char *font;
37 const char *background_color;
38 const char *foreground_color;
39 const char *selbackground_color;
40 const char *selforeground_color;
41 const char *separator_color;
42 const char *border_color;
43 int width_pixels;
44 int height_pixels;
45 int border_pixels;
46 int separator_pixels;
47 int gap_pixels;
48 int triangle_width;
49 int triangle_height;
50 int iconpadding;
51 int horzpadding;
52 int alignment;
53
54 /* the values below are set by options */
55 int monitor;
56 int posx, posy; /* rootmenu position */
57
58 /* the value below is computed by xmenu */
59 int iconsize;
60};
61
62/* draw context structure */
63struct DC {
64 XftColor normal[ColorLast];
65 XftColor selected[ColorLast];
66 XftColor border;
67 XftColor separator;
68
69 GC gc;
70
71 FcPattern *pattern;
72 XftFont **fonts;
73 size_t nfonts;
74};
75
76/* menu item structure */
77struct Item {
78 char *label; /* string to be drawed on menu */
79 char *output; /* string to be outputed when item is clicked */
80 char *file; /* filename of the icon */
81 int y; /* item y position relative to menu */
82 int h; /* item height */
83 int textw; /* text width */
84 struct Item *prev; /* previous item */
85 struct Item *next; /* next item */
86 struct Menu *submenu; /* submenu spawned by clicking on item */
87 Drawable sel, unsel; /* pixmap for selected and unselected item */
88 Imlib_Image icon;
89};
90
91/* monitor geometry structure */
92struct Monitor {
93 int x, y, w, h; /* monitor geometry */
94};
95
96/* menu structure */
97struct Menu {
98 struct Menu *parent; /* parent menu */
99 struct Item *caller; /* item that spawned the menu */
100 struct Item *list; /* list of items contained by the menu */
101 struct Item *selected; /* item currently selected in the menu */
102 int x, y, w, h; /* menu geometry */
103 int hasicon; /* whether the menu has item with icons */
104 int drawn; /* whether the menu was already drawn */
105 int maxtextw; /* maximum text width */
106 unsigned level; /* menu level relative to root */
107 Window win; /* menu window to map on the screen */
108 XIC xic; /* input context */
109};