1999-09-09 Federico Mena Quintero <federico@redhat.com>
[midnight-commander.git] / src / key.h
blob1f517cf6fe258a5d98e5a66a881e0aafb132e1e3
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);
7 void init_textmode_x11_support (void);
8 void done_textmode_x11_support (void);
10 int get_event (Gpm_Event *event, int redo_event, int block);
11 int is_idle (void);
12 int ctrl_pressed (void);
14 #ifndef PORT_HAS_GETCH
15 int mi_getch (void);
16 #endif
17 /* Possible return values from get_event: */
18 #define EV_MOUSE -2
19 #define EV_NONE -1
21 /* Used to get the modifier information */
22 /* Currently, it just works on the Linux console */
23 #ifdef _OS_NT
24 # ifndef SHIFT_PRESSED
25 # define SHIFT_PRESSED 0x0010
26 # endif
27 #else
28 # define SHIFT_PRESSED 1
29 #endif
30 #define ALTR_PRESSED 2
31 #define CONTROL_PRESSED 4
32 #define ALTL_PRESSED 8
33 int get_modifier (void);
35 extern int double_click_speed;
36 extern int old_esc_mode;
37 extern int irix_fn_keys;
38 extern int use_8th_bit_as_meta;
40 /* While waiting for input, the program can select on more than one file */
42 typedef int (*select_fn)(int fd, void *info);
44 /* Channel manipulation */
45 void add_select_channel (int fd, select_fn callback, void *info);
46 void delete_select_channel (int fd);
47 void remove_select_channel (int fd);
49 /* Activate/deactivate the channel checking */
50 void channels_up (void);
51 void channels_down (void);
53 /* Abort/Quit chars */
54 int is_abort_char (int c);
55 int is_quit_char (int c);
57 #define XCTRL(x) ((x) & 31)
58 #define ALT(x) (0x200 | (unsigned int)(x))
60 /* To define sequences and return codes */
61 #define MCKEY_NOACTION 0
62 #define MCKEY_ESCAPE 1
64 /* Return code for the mouse sequence */
65 #define MCKEY_MOUSE -2
67 void do_define_key (int code, char *strcap);
68 void define_sequence (int code, char *seq, int action);
70 /* internally used in key.c, defined in keyxtra.c */
71 void load_xtra_key_defines (void);
73 /* Learn a single key */
74 char *learn_key (void);
76 /* Returns a key code (interpreted) */
77 int get_key_code (int nodelay);
79 typedef struct {
80 int code;
81 char *name;
82 char *longname;
83 } key_code_name_t;
85 extern key_code_name_t key_name_conv_tab [];
86 extern int we_are_background;
88 /* Set keypad mode (xterm and linux console only) */
89 #ifndef HAVE_X
90 void numeric_keypad_mode (void);
91 void application_keypad_mode (void);
92 #endif
94 #endif /* __KEY_H */