From 77a70734c980d1afa24c8d91112edf0d6374ed3c Mon Sep 17 00:00:00 2001 From: midipix Date: Aug 11 2016 01:47:32 +0000 Subject: console: reader: added ptyc_translate_virtual_keycode(). --- diff --git a/src/console/ptyc_console_reader.c b/src/console/ptyc_console_reader.c index 44287ec..803b9c3 100644 --- a/src/console/ptyc_console_reader.c +++ b/src/console/ptyc_console_reader.c @@ -14,6 +14,8 @@ typedef nt_unicode_conversion_params_utf16_to_utf8 uc_conv_params; +extern const struct ptyc_vkcode ptyc_vkcode[0x100]; + static size_t ptyc_repeat(unsigned char * ch, size_t n, uint16_t count) { unsigned char * dst; @@ -56,6 +58,21 @@ static size_t ptyc_repeat(unsigned char * ch, size_t n, uint16_t count) return n*count; } +static size_t ptyc_translate_virtual_keycode( + nt_input_record * rec, + unsigned char * ch) +{ + ntapi->tt_generic_memcpy( + ch, + ptyc_vkcode[rec->key_event.virtual_key_code].mbstr, + ptyc_vkcode[rec->key_event.virtual_key_code].mblen); + + return ptyc_repeat( + ch, + ptyc_vkcode[rec->key_event.virtual_key_code].mblen, + rec->key_event.repeat_count); +} + static size_t ptyc_translate_keyboard_event( nt_input_record * rec, unsigned char * ch, @@ -70,7 +87,8 @@ static size_t ptyc_translate_keyboard_event( return 0; if (!(recwch = rec->key_event.unicode_char)) - return 0; + return ptyc_translate_virtual_keycode( + rec,ch); if (*wch) { if ((recwch < 0xDC00) || (recwch >= 0xE000)) {