From e189a7e1146876b8fe89b25e72fa32eca003acc5 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 27 Nov 2006 18:18:06 +0100 Subject: [PATCH] Make ELinks more BSD console friendly Conditionally define keys, such as DEL, when compiling on a system having the BSD console system headers. A combination of the changes: 791cab91e7def78760dfcef01ee665bb8b0e98cb cfbe41aa8ae80d3a6bc4c6c439c4391f0e40f482 fae675316baa9ba0ccaefe538ddd58ddd0f202b5 --- src/terminal/kbd.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c index 408cebff..c084d0fd 100644 --- a/src/terminal/kbd.c +++ b/src/terminal/kbd.c @@ -37,7 +37,6 @@ #include "util/string.h" #include "util/time.h" - /* TODO: move stuff from here to itrm.{c,h} and mouse.{c,h} */ struct itrm *ditrm = NULL; @@ -636,6 +635,7 @@ get_esc_code(unsigned char *str, int len, unsigned char *code, int *num) /* #define DEBUG_ITRM_QUEUE */ #ifdef DEBUG_ITRM_QUEUE +#include #include /* isprint() isspace() */ #endif @@ -680,6 +680,19 @@ decode_terminal_escape_sequence(struct itrm *itrm, struct term_event *ev) case 'H': kbd.key = KBD_HOME; break; case 'I': kbd.key = KBD_PAGE_UP; break; case 'G': kbd.key = KBD_PAGE_DOWN; break; +/* Free BSD */ +/* case 'M': kbd.key = KBD_F1; break;*/ + case 'N': kbd.key = KBD_F2; break; + case 'O': kbd.key = KBD_F3; break; + case 'P': kbd.key = KBD_F4; break; + case 'Q': kbd.key = KBD_F5; break; +/* case 'R': kbd.key = KBD_F6; break;*/ + case 'S': kbd.key = KBD_F7; break; + case 'T': kbd.key = KBD_F8; break; + case 'U': kbd.key = KBD_F9; break; + case 'V': kbd.key = KBD_F10; break; + case 'W': kbd.key = KBD_F11; break; + case 'X': kbd.key = KBD_F12; break; case 'z': switch (v) { case 247: kbd.key = KBD_INS; break; @@ -757,12 +770,19 @@ set_kbd_event(struct term_event *ev, int key, int modifier) case ASCII_TAB: key = KBD_TAB; break; - +#if defined(HAVE_SYS_CONSIO_H) || defined(HAVE_MACHINE_CONSOLE_H) /* BSD */ + case ASCII_BS: + key = KBD_BS; + break; + case ASCII_DEL: + key = KBD_DEL; + break; +#else case ASCII_BS: case ASCII_DEL: key = KBD_BS; break; - +#endif case ASCII_LF: case ASCII_CR: key = KBD_ENTER;