root/lib/tty/key.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. is_abort_char

   1 /** \file key.h
   2  *  \brief Header: keyboard support routines
   3  */
   4 
   5 #ifndef MC__KEY_H
   6 #define MC__KEY_H
   7 
   8 #include "lib/global.h"         /* <glib.h> */
   9 #include "tty.h"                /* KEY_F macro */
  10 
  11 /*** typedefs(not structures) and defined constants **********************************************/
  12 
  13 /* Possible return values from tty_get_event: */
  14 #define EV_MOUSE   -2
  15 #define EV_NONE    -1
  16 
  17 /*
  18  * Internal representation of the key modifiers.  It is used in the
  19  * sequence tables and the keycodes in the mc sources.
  20  */
  21 #define KEY_M_SHIFT 0x1000
  22 #define KEY_M_ALT   0x2000
  23 #define KEY_M_CTRL  0x4000
  24 #define KEY_M_MASK  0x7000
  25 
  26 #define XCTRL(x) (KEY_M_CTRL | ((x) & 0x1F))
  27 #define ALT(x) (KEY_M_ALT | (unsigned int)(x))
  28 
  29 /* To define sequences and return codes */
  30 #define MCKEY_NOACTION  0
  31 #define MCKEY_ESCAPE    1
  32 
  33 /* Return code for the mouse sequence */
  34 #define MCKEY_MOUSE     -2
  35 
  36 /* Return code for the extended mouse sequence */
  37 #define MCKEY_EXTENDED_MOUSE     -3
  38 
  39 /* Return code for brackets of bracketed paste mode */
  40 #define MCKEY_BRACKETED_PASTING_START -4
  41 #define MCKEY_BRACKETED_PASTING_END   -5
  42 
  43 /*** enums ***************************************************************************************/
  44 
  45 /*** structures declarations (and typedefs of structures)*****************************************/
  46 
  47 typedef struct
  48 {
  49     int code;
  50     const char *name;
  51     const char *longname;
  52     const char *shortcut;
  53 } key_code_name_t;
  54 
  55 struct Gpm_Event;
  56 
  57 /*** global variables defined in .c file *********************************************************/
  58 
  59 extern const key_code_name_t key_name_conv_tab[];
  60 
  61 extern int old_esc_mode_timeout;
  62 
  63 extern int double_click_speed;
  64 extern gboolean old_esc_mode;
  65 extern gboolean use_8th_bit_as_meta;
  66 extern int mou_auto_repeat;
  67 
  68 extern gboolean bracketed_pasting_in_progress;
  69 
  70 /*** declarations of public functions ************************************************************/
  71 
  72 gboolean define_sequence (int code, const char *seq, int action);
  73 
  74 void init_key (void);
  75 void init_key_input_fd (void);
  76 void done_key (void);
  77 
  78 long tty_keyname_to_keycode (const char *name, char **label);
  79 char *tty_keycode_to_keyname (const int keycode);
  80 /* mouse support */
  81 int tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block);
  82 gboolean is_idle (void);
  83 int tty_getch (void);
  84 
  85 /* While waiting for input, the program can select on more than one file */
  86 typedef int (*select_fn) (int fd, void *info);
  87 
  88 /* Channel manipulation */
  89 void add_select_channel (int fd, select_fn callback, void *info);
  90 void delete_select_channel (int fd);
  91 
  92 /* Activate/deactivate the channel checking */
  93 void channels_up (void);
  94 void channels_down (void);
  95 
  96 /* internally used in key.c, defined in keyxtra.c */
  97 void load_xtra_key_defines (void);
  98 
  99 /* Learn a single key */
 100 char *learn_key (void);
 101 
 102 /* Returns a key code (interpreted) */
 103 int get_key_code (int nodelay);
 104 
 105 /* Set keypad mode (xterm and linux console only) */
 106 void numeric_keypad_mode (void);
 107 void application_keypad_mode (void);
 108 
 109 /* Bracketed paste mode */
 110 void enable_bracketed_paste (void);
 111 void disable_bracketed_paste (void);
 112 
 113 /*** inline functions ****************************************************************************/
 114 
 115 static inline gboolean
 116 is_abort_char (int c)
     /* [previous][next][first][last][top][bottom][index][help]  */
 117 {
 118     return ((c == (int) ESC_CHAR) || (c == (int) KEY_F (10)));
 119 }
 120 
 121 #endif /* MC_KEY_H */

/* [previous][next][first][last][top][bottom][index][help]  */