summaryrefslogtreecommitdiffhomepage
path: root/src/console/ptyc_console_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/console/ptyc_console_reader.c')
-rw-r--r--src/console/ptyc_console_reader.c20
1 files changed, 19 insertions, 1 deletions
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)) {