mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
terminal: Introduce term_event_key_T.
This commit is contained in:
parent
e101f5f537
commit
f3b04b8645
@ -948,7 +948,7 @@ menu_kbd_handler(struct menu *menu, struct term_event *ev)
|
||||
|
||||
default:
|
||||
{
|
||||
int key = get_kbd_key(ev);
|
||||
term_event_key_T key = get_kbd_key(ev);
|
||||
|
||||
if (is_kbd_fkey(key)
|
||||
|| check_kbd_modifier(ev, KBD_MOD_ALT)) {
|
||||
|
@ -354,7 +354,7 @@ static struct key key_table[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
long
|
||||
term_event_key_T
|
||||
read_key(unsigned char *key_str)
|
||||
{
|
||||
struct key *key;
|
||||
@ -366,7 +366,7 @@ read_key(unsigned char *key_str)
|
||||
if (!strcasecmp(key->str, key_str))
|
||||
return key->num;
|
||||
|
||||
return -1;
|
||||
return KBD_UNDEF;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -173,7 +173,7 @@ action_requires_form(enum keymap_id keymap_id, action_id_T action_id)
|
||||
return action && (action->flags & ACTION_REQUIRE_FORM);
|
||||
}
|
||||
|
||||
long read_key(unsigned char *);
|
||||
term_event_key_T read_key(unsigned char *);
|
||||
unsigned char *get_keymap_name(enum keymap_id);
|
||||
|
||||
int parse_keystroke(unsigned char *, struct term_event_keyboard *);
|
||||
|
@ -3,13 +3,15 @@
|
||||
|
||||
struct itrm;
|
||||
|
||||
/* Values <= -0x100 are special; e.g. KBD_ENTER.
|
||||
* Values between -0xFF and -2 are not used yet; treat as special.
|
||||
* Value == -1 is KBD_UNDEF; not sent via socket.
|
||||
* Values >= 0 are characters received from the terminal;
|
||||
* in UCS-4 #ifdef CONFIG_UTF_8. */
|
||||
typedef int term_event_key_T;
|
||||
|
||||
struct term_event_keyboard {
|
||||
/* Values <= -0x100 are special; e.g. KBD_ENTER.
|
||||
* Values between -0xFF and -2 are not used yet; treat as special.
|
||||
* Value == -1 is KBD_UNDEF; not sent via socket.
|
||||
* Values >= 0 are characters received from the terminal;
|
||||
* in UCS-4 #ifdef CONFIG_UTF_8. */
|
||||
int key;
|
||||
term_event_key_T key;
|
||||
int modifier;
|
||||
};
|
||||
|
||||
@ -22,6 +24,8 @@ struct interlink_event_keyboard {
|
||||
int modifier;
|
||||
};
|
||||
|
||||
/* Values for term_event_key_T */
|
||||
|
||||
#define KBD_UNDEF -1
|
||||
|
||||
#define KBD_ENTER (-0x100)
|
||||
@ -51,12 +55,14 @@ struct interlink_event_keyboard {
|
||||
#define KBD_F10 (-0x129)
|
||||
#define KBD_F11 (-0x12a)
|
||||
#define KBD_F12 (-0x12b)
|
||||
static inline int is_kbd_fkey(int key) { return key <= KBD_F1 && key >= KBD_F12; }
|
||||
static inline int is_kbd_fkey(term_event_key_T key) { return key <= KBD_F1 && key >= KBD_F12; }
|
||||
#define number_to_kbd_fkey(num) (KBD_F1 - (num) + 1)
|
||||
#define kbd_fkey_to_number(key) (KBD_F1 - (key) + 1)
|
||||
|
||||
#define KBD_CTRL_C (-0x200)
|
||||
|
||||
/* Values for term_event_keyboard.modifier and
|
||||
* interlink_event_keyboard.modifier */
|
||||
#define KBD_MOD_NONE 0
|
||||
#define KBD_MOD_SHIFT 1
|
||||
#define KBD_MOD_CTRL 2
|
||||
|
@ -1178,7 +1178,7 @@ enum frame_event_status
|
||||
try_document_key(struct session *ses, struct document_view *doc_view,
|
||||
struct term_event *ev)
|
||||
{
|
||||
long key;
|
||||
term_event_key_T key;
|
||||
int passed = -1;
|
||||
int i; /* GOD I HATE C! --FF */ /* YEAH, BRAINFUCK RULEZ! --pasky */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user