Reverted the use of bool in favour of gboolean
[midnight-commander.git] / src / key.h
blobb1dbbe564aaa59573de20443868633a85852d2b2
1 #ifndef MC_KEY_H
2 #define MC_KEY_H
4 void init_key (void);
5 void init_key_input_fd (void);
6 void done_key (void);
8 struct Gpm_Event;
9 int get_event (struct Gpm_Event *event, int redo_event, int block);
10 int is_idle (void);
12 int mi_getch (void);
13 /* Possible return values from get_event: */
14 #define EV_MOUSE -2
15 #define EV_NONE -1
19 * Internal representation of the key modifiers. It is used in the
20 * sequence tables and the keycodes in the mc sources.
22 #define KEY_M_SHIFT 0x1000
23 #define KEY_M_ALT 0x2000
24 #define KEY_M_CTRL 0x4000
25 #define KEY_M_MASK 0x7000
27 extern int double_click_speed;
28 extern int old_esc_mode;
29 extern int irix_fn_keys;
30 extern int use_8th_bit_as_meta;
32 /* While waiting for input, the program can select on more than one file */
34 typedef int (*select_fn)(int fd, void *info);
36 /* Channel manipulation */
37 void add_select_channel (int fd, select_fn callback, void *info);
38 void delete_select_channel (int fd);
39 void remove_select_channel (int fd);
41 /* Activate/deactivate the channel checking */
42 void channels_up (void);
43 void channels_down (void);
45 /* Abort/Quit chars */
46 int is_abort_char (int c);
47 int is_quit_char (int c);
49 #define XCTRL(x) (KEY_M_CTRL | ((x) & 31))
50 #define ALT(x) (KEY_M_ALT | (unsigned int)(x))
52 /* To define sequences and return codes */
53 #define MCKEY_NOACTION 0
54 #define MCKEY_ESCAPE 1
56 /* Return code for the mouse sequence */
57 #define MCKEY_MOUSE -2
59 int define_sequence (int code, const char *seq, int action);
61 /* internally used in key.c, defined in keyxtra.c */
62 void load_xtra_key_defines (void);
64 /* Learn a single key */
65 char *learn_key (void);
67 /* Returns a key code (interpreted) */
68 int get_key_code (int nodelay);
70 typedef const struct {
71 int code;
72 const char *name;
73 const char *longname;
74 } key_code_name_t;
76 extern key_code_name_t key_name_conv_tab [];
78 /* Set keypad mode (xterm and linux console only) */
79 void numeric_keypad_mode (void);
80 void application_keypad_mode (void);
82 #endif