3 * Retrieval and storage of keybindings.
11 #include <stdint.h> /* for uint16_t */
17 /* Individual keybinding. */
20 char * name; /* name of functionality bound to keycode */
21 uint16_t key; /* keycode */
26 /* Metadata used by the keybinding editing window. */
29 uint16_t max; /* index of last keybinding (= n of keybindings - 1) */
30 char edit; /* 1 if currently editing a keybinding, else 0 */
31 uint16_t select; /* index of keybinding selected for editing */
36 /* Read keybindings data from / write them to the file "keybindings". */
37 extern void init_keybindings(struct World * world);
38 extern void save_keybindings(struct World * world);
42 /* Return keycode matching a key (functionality) name. */
43 extern uint16_t get_action_key(struct KeyBinding * keybindings, char * name);
47 /* Translate keycode to readable names of max 9 chars where possible. */
48 extern char * get_keyname(uint16_t keycode);
52 /* Mark selection in keybindings window modifiable, get user input to modify
53 * key. Ensure there are max. three digits in the keycode ASCII representation.
55 extern void keyswin_mod_key(struct World * world, struct WinMeta * win_meta);
59 /* Move selection in keybinding window upwards ("dir" = "u") or downwards ("dir"
60 * = "d") within the limits of the keybindings list length.
62 extern void keyswin_move_selection(struct World * world, char dir);