1 /* src/client/keybindings.h
3 * Database of keybindings and functions to read and manipulate it.
9 #include <stdint.h> /* uint8_t, uint16_t */
15 struct KeyBinding * next;
16 uint16_t key; /* keycode */
17 char * name; /* name of functionality bound to keycode */
22 struct KeyBinding * kbs;
23 uint16_t select; /* linear list index of keybinding selected for editing */
24 uint8_t edit; /* 1 if currently editing a keybinding, else 0 */
29 /* Return name of action / functionality coupled to keycode; NULL on failure. */
30 extern char * get_actionname_to_keycode(struct KeyBinding * kb_p, uint16_t key);
32 /* Return keycode matched by keybinding to command of "name". */
33 extern uint16_t get_keycode_to_action(struct KeyBinding * keybindings,
36 /* Return human-readable name (of maximum 9 chars) for "keycode" as matched by
37 * ncurses.h; if none is found, return "UNKNOWN".
39 extern char * get_name_to_keycode(uint16_t keycode);
41 /* Initialize/save keybindings data from/to file at "path" to/from keybindings
44 extern void init_keybindings(char * path, struct KeyBindingDB * kbd);
45 extern void save_keybindings(char * path, struct KeyBindingDB * kbd);
47 /* Free keybinding chain starting at "kb_start". */
48 extern void free_keybindings(struct KeyBinding * kb_start);
50 /* Mark keybinding selected for modification as being edited, get user input to
51 * modify it, then unmark it again. Ensure there are max. three digits in the
52 * ASCII representation of the keycode read from the user.
54 extern void mod_selected_keyb(struct KeyBindingDB * kbd);
56 /* Move keybinding modification selection upwards ("dir"=="u") or downwards
57 * ("dir"=="d") within the limits of the keybindings chain length.
59 extern void move_keyb_mod_selection(struct KeyBindingDB * kbd, char dir);