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