Merge commit 'origin/340_inrorrect_handling_of_wildcards'
[midnight-commander.git] / src / key.h
blob1e340488fe4c1398db8151cf748d0601190b02c6
2 /** \file key.h
3 * \brief Header: keyboard support routines
4 */
6 #ifndef MC_KEY_H
7 #define MC_KEY_H
9 void init_key (void);
10 void init_key_input_fd (void);
11 void done_key (void);
13 struct Gpm_Event;
14 int get_event (struct Gpm_Event *event, int redo_event, int block);
15 int is_idle (void);
17 int mi_getch (void);
18 /* Possible return values from get_event: */
19 #define EV_MOUSE -2
20 #define EV_NONE -1
24 * Internal representation of the key modifiers. It is used in the
25 * sequence tables and the keycodes in the mc sources.
27 #define KEY_M_SHIFT 0x1000
28 #define KEY_M_ALT 0x2000
29 #define KEY_M_CTRL 0x4000
30 #define KEY_M_MASK 0x7000
32 extern int double_click_speed;
33 extern int old_esc_mode;
34 extern int irix_fn_keys;
35 extern int use_8th_bit_as_meta;
37 /* While waiting for input, the program can select on more than one file */
39 typedef int (*select_fn)(int fd, void *info);
41 /* Channel manipulation */
42 void add_select_channel (int fd, select_fn callback, void *info);
43 void delete_select_channel (int fd);
44 void remove_select_channel (int fd);
46 /* Activate/deactivate the channel checking */
47 void channels_up (void);
48 void channels_down (void);
50 /* Abort/Quit chars */
51 int is_abort_char (int c);
52 int is_quit_char (int c);
54 #define XCTRL(x) (KEY_M_CTRL | ((x) & 31))
55 #define ALT(x) (KEY_M_ALT | (unsigned int)(x))
57 /* To define sequences and return codes */
58 #define MCKEY_NOACTION 0
59 #define MCKEY_ESCAPE 1
61 /* Return code for the mouse sequence */
62 #define MCKEY_MOUSE -2
64 int define_sequence (int code, const char *seq, int action);
66 /* internally used in key.c, defined in keyxtra.c */
67 void load_xtra_key_defines (void);
69 /* Learn a single key */
70 char *learn_key (void);
72 /* Returns a key code (interpreted) */
73 int get_key_code (int nodelay);
75 typedef const struct {
76 int code;
77 const char *name;
78 const char *longname;
79 } key_code_name_t;
81 extern key_code_name_t key_name_conv_tab [];
83 /* Set keypad mode (xterm and linux console only) */
84 void numeric_keypad_mode (void);
85 void application_keypad_mode (void);
87 #endif