mc/src/key.h

84 lines
1.9 KiB
C
Raw Normal View History

1998-02-27 07:54:42 +03:00
#ifndef __KEY_H
#define __KEY_H
#include "mouse.h" /* Gpm_Event */
1998-02-27 07:54:42 +03:00
void init_key (void);
void init_key_input_fd (void);
void done_key (void);
1998-02-27 07:54:42 +03:00
int get_event (Gpm_Event *event, int redo_event, int block);
int is_idle (void);
int mi_getch (void);
/* Possible return values from get_event: */
#define EV_MOUSE -2
#define EV_NONE -1
/*
* Internal representation of the key modifiers. It is used in the
* sequence tables and the keycodes in the mc sources.
*/
#define KEY_M_SHIFT 0x1000
#define KEY_M_ALT 0x2000
#define KEY_M_CTRL 0x4000
#define KEY_M_MASK 0x7000
1998-02-27 07:54:42 +03:00
extern int double_click_speed;
extern int old_esc_mode;
extern int irix_fn_keys;
extern int use_8th_bit_as_meta;
/* While waiting for input, the program can select on more than one file */
typedef int (*select_fn)(int fd, void *info);
/* Channel manipulation */
void add_select_channel (int fd, select_fn callback, void *info);
void delete_select_channel (int fd);
void remove_select_channel (int fd);
/* Activate/deactivate the channel checking */
void channels_up (void);
void channels_down (void);
/* Abort/Quit chars */
int is_abort_char (int c);
int is_quit_char (int c);
#define XCTRL(x) (KEY_M_CTRL | ((x) & 31))
#define ALT(x) (KEY_M_ALT | (unsigned int)(x))
1998-02-27 07:54:42 +03:00
/* To define sequences and return codes */
#define MCKEY_NOACTION 0
#define MCKEY_ESCAPE 1
/* Return code for the mouse sequence */
#define MCKEY_MOUSE -2
int define_sequence (int code, char *seq, int action);
1998-02-27 07:54:42 +03:00
/* internally used in key.c, defined in keyxtra.c */
void load_xtra_key_defines (void);
1998-02-27 07:54:42 +03:00
/* Learn a single key */
char *learn_key (void);
/* Returns a key code (interpreted) */
int get_key_code (int nodelay);
typedef const struct {
1998-02-27 07:54:42 +03:00
int code;
char *name;
char *longname;
} key_code_name_t;
extern key_code_name_t key_name_conv_tab [];
Wed Apr 1 00:15:30 1998 Norbert Warmuth <k3190@fh-sw.de> * key.c, key.h (numeric_keypad_mode, application_keypad_mode): New functions which encapsulate two hardcoded escape sequences from main.c. * main.c (main): Use the two new functions from key.c * main.c, screen.c: Moved all file selection keys from the default keymap to the keymap for panels in listing mode. Changed *_selection_cmd to *_selection_cmd_panel in panel_keymap (functions in panel_keymap get a WPanel * as first parameter, i.e. the indirection with cpanel isn't necessary). * main.c (midnight_callback): Keys '*' and '-' were not treated when only_leading_plus_minus==0; Optimized the if-clauses a little bit (i.e. removed duplicate checks). More optimation is possible but it would make the whole stuff completly unreadable. * key.c (correct_key_code): KP_ADD, KP_SUBTRACT and KP_MULTIPLY will be translated to +, - and * only if the option alternate_plus_minus is turned off. * learn.c (learn_keys): Turn alternate_plus_minus temporarily on to avoid translation of KP_ADD, KP_SUBTRACT and KP_MULTIPLY in correct_key_code/make sure keypad is in application mode (makes it possible to learn this keys). * cmd.c (reverse_selection_cmd_panel): New function (renamed from reverse_selection_cmd, takes a WPanel * as parameter, references to cpanel changed to panel/the passed parameter). reverse_selection_cmd now simply calls this function with cpanel. This pair was missing among the *_selection_cmd* functions. * cmd.h: Added function prototypes.
1998-04-01 02:36:24 +04:00
/* Set keypad mode (xterm and linux console only) */
void numeric_keypad_mode (void);
void application_keypad_mode (void);
1998-02-27 07:54:42 +03:00
#endif /* __KEY_H */