summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-08-07 09:29:02 -0400
committermidipix <writeonce@midipix.org>2016-08-10 21:47:32 -0400
commit77a70734c980d1afa24c8d91112edf0d6374ed3c (patch)
treedf8449b492ebc0cfc89eebaaa4524d2a16e5b150
parent92a5107f9f3c4259b928795dc98084e88eb333fa (diff)
downloadptycon-77a70734c980d1afa24c8d91112edf0d6374ed3c.tar.bz2
ptycon-77a70734c980d1afa24c8d91112edf0d6374ed3c.tar.xz
console: reader: added ptyc_translate_virtual_keycode().
-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)) {