*** empty log message ***
[midnight-commander.git] / src / key.h
blobb0fa64c78bd22dad1490458a06e7c8d8c4461771
1 #ifndef __KEY_H
2 #define __KEY_H
4 void init_key (void);
5 void init_key_input_fd (void);
6 void done_key (void);
8 int get_event (Gpm_Event *event, int redo_event, int block);
9 int is_idle (void);
10 int ctrl_pressed (void);
12 int mi_getch (void);
13 /* Possible return values from get_event: */
14 #define EV_MOUSE -2
15 #define EV_NONE -1
17 /* Used to get the modifier information */
18 /* Currently, it just works on the Linux console */
19 #ifdef _OS_NT
20 # ifndef SHIFT_PRESSED
21 # define SHIFT_PRESSED 0x0010
22 # endif
23 #else
24 # define SHIFT_PRESSED 1
25 #endif
26 #define ALTR_PRESSED 2
27 #define CONTROL_PRESSED 4
28 #define ALTL_PRESSED 8
29 int get_modifier (void);
31 extern int double_click_speed;
32 extern int old_esc_mode;
33 extern int irix_fn_keys;
34 extern int use_8th_bit_as_meta;
36 /* While waiting for input, the program can select on more than one file */
38 typedef int (*select_fn)(int fd, void *info);
40 /* Channel manipulation */
41 void add_select_channel (int fd, select_fn callback, void *info);
42 void delete_select_channel (int fd);
43 void remove_select_channel (int fd);
45 /* Activate/deactivate the channel checking */
46 void channels_up (void);
47 void channels_down (void);
49 /* Abort/Quit chars */
50 int is_abort_char (int c);
51 int is_quit_char (int c);
53 #define XCTRL(x) ((x) & 31)
54 #define ALT(x) (0x200 | (unsigned int)(x))
56 /* To define sequences and return codes */
57 #define MCKEY_NOACTION 0
58 #define MCKEY_ESCAPE 1
60 /* Return code for the mouse sequence */
61 #define MCKEY_MOUSE -2
63 int define_sequence (int code, char *seq, int action);
65 /* internally used in key.c, defined in keyxtra.c */
66 void load_xtra_key_defines (void);
68 /* Learn a single key */
69 char *learn_key (void);
71 /* Returns a key code (interpreted) */
72 int get_key_code (int nodelay);
74 typedef struct {
75 int code;
76 char *name;
77 char *longname;
78 } key_code_name_t;
80 extern key_code_name_t key_name_conv_tab [];
81 extern int we_are_background;
83 /* Set keypad mode (xterm and linux console only) */
84 void numeric_keypad_mode (void);
85 void application_keypad_mode (void);
87 #endif /* __KEY_H */