Lots of cleanups to fvwm-menu-desktop
[fvwm.git] / fvwm / menubindings.h
blob990386d203c64b24bf2bfd5acc8c4189371f47a7
1 /* -*-c-*- */
3 #ifndef MENU_BINDINGS_H
4 #define MENU_BINDINGS_H
6 /* ---------------------------- included header files ---------------------- */
8 /* Do not #include any files - the file including this file has to take care of
9 * it. */
11 /* ---------------------------- global definitions ------------------------- */
13 /* ---------------------------- global macros ------------------------------ */
15 /* ---------------------------- forward declarations ----------------------- */
17 struct MenuRoot;
18 struct MenuParameters;
19 struct MenuReturn;
20 struct MenuItem;
22 /* ---------------------------- type definitions --------------------------- */
24 typedef struct
26 unsigned int keystate;
27 unsigned int keycode;
28 Time timestamp;
29 } double_keypress;
31 typedef enum
33 SA_NONE = 0,
34 SA_ENTER,
35 SA_LEAVE,
36 SA_MOVE_ITEMS,
37 SA_FIRST,
38 SA_LAST,
39 SA_CONTINUE,
40 SA_WARPBACK,
41 SA_SELECT,
42 SA_TEAROFF,
43 SA_ABORT,
44 SA_SCROLL,
45 SA_EXEC_CMD
46 } menu_shortcut_action;
48 /* ---------------------------- exported variables (globals) --------------- */
50 /* Do not use global variable. Full stop. */
52 /* ---------------------------- interface functions ------------------------ */
54 /* Before this function is called, all menu bindings created through
55 * menu_binding() are permanent i.e. they can not be deleted (although
56 * overridden). After calling it, new bindings are stored in the regular list
57 * and can be deleted by the user as usual.
59 * To be called by SetRCDefaults *only*. */
60 void menu_bindings_startup_complete(void);
62 /* Parse a menu binding and store it.
64 * To be called from bindings.c *only*. */
65 int menu_binding(
66 Display *dpy, binding_t type, int button, KeySym keysym,
67 int context, int modifier, char *action, char *menu_style);
69 /* Checks if the given mouse or keyboard event in the given context
70 * corresponds to a menu binding. If so, the binding is returned. Otherwise
71 * NULL is returned.
73 * To be called from menus.c *only*.
75 Binding *menu_binding_is_mouse(XEvent* event, int context);
76 Binding *menu_binding_is_key(XEvent* event, int context);
78 /* Menu keyboard processing
80 * Function called instead of Keyboard_Shortcuts()
81 * when a KeyPress event is received. If the key is alphanumeric,
82 * then the menu is scanned for a matching hot key. Otherwise if
83 * it was the escape key then the menu processing is aborted.
84 * If none of these conditions are true, then the default processing
85 * routine is called.
86 * TKP - uses XLookupString so that keypad numbers work with windowlist
88 void menu_shortcuts(
89 struct MenuRoot *mr, struct MenuParameters *pmp,
90 struct MenuReturn *pmret, XEvent *event, struct MenuItem **pmi_current,
91 double_keypress *pdkp, int *ret_menu_x, int *ret_menu_y);
93 #endif /* MENU_BINDINGS_H */