mirror of https://github.com/MidnightCommander/mc
TTY: code reorganization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
6b07af2fc4
commit
aadc438c20
|
@ -102,7 +102,7 @@ _("Please press the %s\n"
|
|||
/* Esc hides the dialog and do not allow definitions of
|
||||
* regular characters
|
||||
*/
|
||||
int seq_ok;
|
||||
gboolean seq_ok = FALSE;
|
||||
|
||||
if (*seq && strcmp (seq, "\\e") && strcmp (seq, "\\e\\e")
|
||||
&& strcmp (seq, "^m" ) && strcmp (seq, "^i" )
|
||||
|
@ -113,14 +113,11 @@ _("Please press the %s\n"
|
|||
seq = convert_controls (seq);
|
||||
seq_ok = define_sequence (key_name_conv_tab [action - B_USER].code,
|
||||
seq, MCKEY_NOACTION);
|
||||
} else {
|
||||
seq_ok = 0;
|
||||
}
|
||||
|
||||
if (!seq_ok) {
|
||||
if (!seq_ok)
|
||||
message (D_NORMAL, _(" Cannot accept this key "),
|
||||
_(" You have entered \"%s\""), seq);
|
||||
}
|
||||
|
||||
g_free (seq);
|
||||
}
|
||||
|
|
1506
src/tty/key.c
1506
src/tty/key.c
File diff suppressed because it is too large
Load Diff
|
@ -9,6 +9,10 @@
|
|||
#include "../../src/global.h" /* <glib.h> */
|
||||
#include "../../src/dialog.h" /* cb_ret_t */
|
||||
|
||||
#include "../../src/tty/tty.h" /* KEY_F macro */
|
||||
|
||||
gboolean define_sequence (int code, const char *seq, int action);
|
||||
|
||||
void init_key (void);
|
||||
void init_key_input_fd (void);
|
||||
void done_key (void);
|
||||
|
@ -32,14 +36,13 @@ extern key_code_name_t key_name_conv_tab [];
|
|||
/* mouse support */
|
||||
struct Gpm_Event;
|
||||
int tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block);
|
||||
int is_idle (void);
|
||||
gboolean is_idle (void);
|
||||
int tty_getch (void);
|
||||
|
||||
/* Possible return values from tty_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.
|
||||
|
@ -66,11 +69,16 @@ void remove_select_channel (int fd);
|
|||
void channels_up (void);
|
||||
void channels_down (void);
|
||||
|
||||
gboolean is_abort_char (int c);
|
||||
|
||||
#define XCTRL(x) (KEY_M_CTRL | ((x) & 31))
|
||||
#define ALT(x) (KEY_M_ALT | (unsigned int)(x))
|
||||
|
||||
static inline gboolean
|
||||
is_abort_char (int c)
|
||||
{
|
||||
return ((c == XCTRL ('c')) || (c == XCTRL ('g'))
|
||||
|| (c == ESC_CHAR) || (c == KEY_F (10)));
|
||||
}
|
||||
|
||||
/* To define sequences and return codes */
|
||||
#define MCKEY_NOACTION 0
|
||||
#define MCKEY_ESCAPE 1
|
||||
|
@ -78,7 +86,6 @@ gboolean is_abort_char (int c);
|
|||
/* Return code for the mouse sequence */
|
||||
#define MCKEY_MOUSE -2
|
||||
|
||||
int define_sequence (int code, const char *seq, int action);
|
||||
|
||||
/* internally used in key.c, defined in keyxtra.c */
|
||||
void load_xtra_key_defines (void);
|
||||
|
|
Loading…
Reference in New Issue