* fhandler_console.cc: Remove VK_DIVIDE detection.
(get_nonascii_key): Simplify previous patch to return ascii char if it is non-zero. Add a second "temporary buffer" argument to help with thread safety. * select.cc (peek_console): Pass a temporary buffer argument to get_nonascii_key.
This commit is contained in:
parent
f0a69f46bb
commit
a9867e1b58
|
@ -1,3 +1,12 @@
|
||||||
|
Sun Jul 30 13:54:35 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* fhandler_console.cc: Remove VK_DIVIDE detection.
|
||||||
|
(get_nonascii_key): Simplify previous patch to return ascii char if it
|
||||||
|
is non-zero. Add a second "temporary buffer" argument to help with
|
||||||
|
thread safety.
|
||||||
|
* select.cc (peek_console): Pass a temporary buffer argument to
|
||||||
|
get_nonascii_key.
|
||||||
|
|
||||||
Sat Jul 29 14:32:12 2000 Christopher Faylor <cgf@cygnus.com>
|
Sat Jul 29 14:32:12 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* fhandler_console.cc: Add VK_DIVIDE detection. Return virtual keycode
|
* fhandler_console.cc: Add VK_DIVIDE detection. Return virtual keycode
|
||||||
|
|
|
@ -40,7 +40,7 @@ static struct
|
||||||
|
|
||||||
#define use_tty ISSTATE (myself, PID_USETTY)
|
#define use_tty ISSTATE (myself, PID_USETTY)
|
||||||
|
|
||||||
const char * get_nonascii_key (INPUT_RECORD& input_rec);
|
const char * get_nonascii_key (INPUT_RECORD&, char *);
|
||||||
|
|
||||||
HANDLE console_shared_h;
|
HANDLE console_shared_h;
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ fhandler_console::read (void *pv, size_t buflen)
|
||||||
/* arrow/function keys */
|
/* arrow/function keys */
|
||||||
(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
||||||
{
|
{
|
||||||
toadd = get_nonascii_key (input_rec);
|
toadd = get_nonascii_key (input_rec, tmp);
|
||||||
if (!toadd)
|
if (!toadd)
|
||||||
continue;
|
continue;
|
||||||
nread = strlen (toadd);
|
nread = strlen (toadd);
|
||||||
|
@ -1297,13 +1297,11 @@ static struct {
|
||||||
{VK_NUMPAD5, {"\033[G", NULL, NULL, NULL}},
|
{VK_NUMPAD5, {"\033[G", NULL, NULL, NULL}},
|
||||||
{VK_CLEAR, {"\033[G", NULL, NULL, NULL}},
|
{VK_CLEAR, {"\033[G", NULL, NULL, NULL}},
|
||||||
{'6', {NULL, NULL, "\036", NULL}},
|
{'6', {NULL, NULL, "\036", NULL}},
|
||||||
/* FIXME: Should this be \033OQ? */
|
|
||||||
{VK_DIVIDE, {"/", "/", "/", "/"}},
|
|
||||||
{0, {"", NULL, NULL, NULL}}
|
{0, {"", NULL, NULL, NULL}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
get_nonascii_key (INPUT_RECORD& input_rec)
|
get_nonascii_key (INPUT_RECORD& input_rec, char *tmp)
|
||||||
{
|
{
|
||||||
#define NORMAL 0
|
#define NORMAL 0
|
||||||
#define SHIFT 1
|
#define SHIFT 1
|
||||||
|
@ -1324,12 +1322,11 @@ get_nonascii_key (INPUT_RECORD& input_rec)
|
||||||
if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk)
|
if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk)
|
||||||
return keytable[i].val[modifier_index];
|
return keytable[i].val[modifier_index];
|
||||||
|
|
||||||
if (input_rec.Event.KeyEvent.wVirtualKeyCode < ' ')
|
if (input_rec.Event.KeyEvent.uChar.AsciiChar)
|
||||||
{
|
{
|
||||||
/* FIXME: Probably not thread-safe */
|
tmp[0] = input_rec.Event.KeyEvent.uChar.AsciiChar;
|
||||||
static char buf[2];
|
tmp[1] = '\0';
|
||||||
buf[0] = input_rec.Event.KeyEvent.wVirtualKeyCode;
|
return tmp;
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -597,7 +597,7 @@ fhandler_pipe::select_except (select_record *s)
|
||||||
static int
|
static int
|
||||||
peek_console (select_record *me, int ignra)
|
peek_console (select_record *me, int ignra)
|
||||||
{
|
{
|
||||||
extern const char * get_nonascii_key (INPUT_RECORD& input_rec);
|
extern const char * get_nonascii_key (INPUT_RECORD& input_rec, char *);
|
||||||
fhandler_console *fh = (fhandler_console *)me->fh;
|
fhandler_console *fh = (fhandler_console *)me->fh;
|
||||||
|
|
||||||
if (!me->read_selected)
|
if (!me->read_selected)
|
||||||
|
@ -618,6 +618,7 @@ peek_console (select_record *me, int ignra)
|
||||||
INPUT_RECORD irec;
|
INPUT_RECORD irec;
|
||||||
DWORD events_read;
|
DWORD events_read;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
char tmpbuf[17];
|
||||||
set_handle_or_return_if_not_open (h, me);
|
set_handle_or_return_if_not_open (h, me);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -630,7 +631,7 @@ peek_console (select_record *me, int ignra)
|
||||||
if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT)
|
if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT)
|
||||||
kill_pgrp (fh->tc->getpgid (), SIGWINCH);
|
kill_pgrp (fh->tc->getpgid (), SIGWINCH);
|
||||||
else if (irec.EventType == KEY_EVENT && irec.Event.KeyEvent.bKeyDown == TRUE &&
|
else if (irec.EventType == KEY_EVENT && irec.Event.KeyEvent.bKeyDown == TRUE &&
|
||||||
(irec.Event.KeyEvent.uChar.AsciiChar || get_nonascii_key (irec)))
|
(irec.Event.KeyEvent.uChar.AsciiChar || get_nonascii_key (irec, tmpbuf)))
|
||||||
return me->read_ready = 1;
|
return me->read_ready = 1;
|
||||||
|
|
||||||
/* Read and discard the event */
|
/* Read and discard the event */
|
||||||
|
|
Loading…
Reference in New Issue