+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>
* fhandler_console.cc: Add VK_DIVIDE detection. Return virtual keycode
#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;
/* arrow/function keys */
(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
{
- toadd = get_nonascii_key (input_rec);
+ toadd = get_nonascii_key (input_rec, tmp);
if (!toadd)
continue;
nread = strlen (toadd);
{VK_NUMPAD5, {"\033[G", NULL, NULL, NULL}},
{VK_CLEAR, {"\033[G", NULL, NULL, NULL}},
{'6', {NULL, NULL, "\036", NULL}},
- /* FIXME: Should this be \033OQ? */
- {VK_DIVIDE, {"/", "/", "/", "/"}},
{0, {"", NULL, NULL, NULL}}
};
const char *
-get_nonascii_key (INPUT_RECORD& input_rec)
+get_nonascii_key (INPUT_RECORD& input_rec, char *tmp)
{
#define NORMAL 0
#define SHIFT 1
if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk)
return keytable[i].val[modifier_index];
- if (input_rec.Event.KeyEvent.wVirtualKeyCode < ' ')
+ if (input_rec.Event.KeyEvent.uChar.AsciiChar)
{
- /* FIXME: Probably not thread-safe */
- static char buf[2];
- buf[0] = input_rec.Event.KeyEvent.wVirtualKeyCode;
- return buf;
+ tmp[0] = input_rec.Event.KeyEvent.uChar.AsciiChar;
+ tmp[1] = '\0';
+ return tmp;
}
return NULL;
}
static int
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;
if (!me->read_selected)
INPUT_RECORD irec;
DWORD events_read;
HANDLE h;
+ char tmpbuf[17];
set_handle_or_return_if_not_open (h, me);
for (;;)
if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT)
kill_pgrp (fh->tc->getpgid (), SIGWINCH);
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;
/* Read and discard the event */