1 /* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */ 2 3 /* 4 * This manages short-cut keys of ui_screen key events. 5 */ 6 7 #ifndef __UI_SHORTCUT_H__ 8 #define __UI_SHORTCUT_H__ 9 10 #include "ui.h" 11 #include <pobl/bl_types.h> 12 13 typedef enum ui_key_func { 14 IM_HOTKEY, 15 EXT_KBD, 16 OPEN_SCREEN, 17 OPEN_PTY, 18 NEXT_PTY, 19 PREV_PTY, 20 HSPLIT_SCREEN, 21 VSPLIT_SCREEN, 22 NEXT_SCREEN, 23 PREV_SCREEN, 24 CLOSE_SCREEN, 25 HEXPAND_SCREEN, 26 VEXPAND_SCREEN, 27 PAGE_UP, 28 SCROLL_UP, 29 SCROLL_UP_TO_MARK, 30 SCROLL_DOWN_TO_MARK, 31 INSERT_SELECTION, 32 RESET, 33 COPY_MODE, 34 SET_MARK, 35 EXIT_PROGRAM, 36 37 MAX_KEY_MAPS 38 39 } ui_key_func_t; 40 41 typedef struct ui_key { 42 KeySym ksym; 43 u_int state; 44 int is_used; 45 46 } ui_key_t; 47 48 typedef struct ui_str_key { 49 KeySym ksym; 50 u_int state; 51 char *str; 52 53 } ui_str_key_t; 54 55 typedef struct ui_shortcut { 56 ui_key_t map[MAX_KEY_MAPS]; 57 ui_str_key_t *str_map; 58 u_int str_map_size; 59 60 } ui_shortcut_t; 61 62 void ui_shortcut_init(ui_shortcut_t *shortcut); 63 64 void ui_shortcut_final(ui_shortcut_t *shortcut); 65 66 int ui_shortcut_match(ui_shortcut_t *shortcut, ui_key_func_t func, KeySym sym, u_int state); 67 68 char *ui_shortcut_str(ui_shortcut_t *shortcut, KeySym sym, u_int state); 69 70 int ui_shortcut_parse(ui_shortcut_t *shortcut, char *key, char *oper); 71 72 #endif 73