Merge pull request #223 from ydal/patch-9

dfreerdp : support VK_KANA / VK_HANGUL and VK_HANJA / VK_KANJI
This commit is contained in:
Marc-André Moreau 2011-11-25 07:09:38 -08:00
commit b40ce40449
2 changed files with 29 additions and 6 deletions

View File

@ -23,6 +23,7 @@
#include "df_event.h"
uint8 keymap[256];
uint8 functionmap[128];
void df_keyboard_init()
{
@ -145,6 +146,13 @@ void df_keyboard_init()
keymap[DIKI_META_L - DIKI_UNKNOWN] = VK_LWIN;
keymap[DIKI_META_R - DIKI_UNKNOWN] = VK_RWIN;
keymap[DIKI_SUPER_L - DIKI_UNKNOWN] = VK_APPS;
memset(functionmap, 0, sizeof(functionmap));
functionmap[DFB_FUNCTION_KEY(23) - DFB_FUNCTION_KEY(0)] = VK_HANGUL;
functionmap[DFB_FUNCTION_KEY(24) - DFB_FUNCTION_KEY(0)] = VK_HANJA;
}
void df_send_mouse_button_event(rdpInput* input, boolean down, uint32 button, uint16 x, uint16 y)
@ -169,13 +177,28 @@ void df_send_mouse_motion_event(rdpInput* input, uint16 x, uint16 y)
input->MouseEvent(input, PTR_FLAGS_MOVE, x, y);
}
void df_send_keyboard_event(rdpInput* input, boolean down, uint8 keycode)
void df_send_keyboard_event(rdpInput* input, boolean down, uint8 keycode, uint8 function)
{
uint16 flags;
uint8 vkcode;
uint8 scancode;
boolean extended;
if (keycode)
{
vkcode = keymap[keycode];
}
else if (function)
{
vkcode = functionmap[function];
}
scancode = freerdp_kbd_get_scancode_by_virtualkey(keymap[keycode], &extended);
if (!vkcode)
{
return;
}
scancode = freerdp_kbd_get_scancode_by_virtualkey(vkcode, &extended);
flags = (extended) ? KBD_FLAGS_EXTENDED : 0;
flags |= (down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE;
@ -224,11 +247,11 @@ boolean df_event_process(freerdp* instance, DFBEvent* event)
break;
case DIET_KEYPRESS:
df_send_keyboard_event(instance->input, true, input_event->key_id - DIKI_UNKNOWN);
df_send_keyboard_event(instance->input, true, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0));
break;
case DIET_KEYRELEASE:
df_send_keyboard_event(instance->input, false, input_event->key_id - DIKI_UNKNOWN);
df_send_keyboard_event(instance->input, false, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0));
break;
case DIET_UNKNOWN:

View File

@ -344,11 +344,11 @@ static const virtualKey virtualKeyboard[256 + 2] =
{ 0x38, 0, "VK_MENU" , "LALT" },
{ 0x46, 1, "VK_PAUSE" , "PAUS" },
{ 0x3A, 0, "VK_CAPITAL" , "CAPS" },
{ 0x00, 0, "VK_KANA / VK_HANGUL" , NULL },
{ 0x72, 0, "VK_KANA / VK_HANGUL" , NULL },
{ 0x00, 0, "" , NULL },
{ 0x00, 0, "VK_JUNJA" , NULL },
{ 0x00, 0, "VK_FINAL" , NULL },
{ 0x00, 0, "VK_HANJA / VK_KANJI" , NULL },
{ 0x71, 0, "VK_HANJA / VK_KANJI" , NULL },
{ 0x00, 0, "" , NULL },
{ 0x01, 0, "VK_ESCAPE" , "ESC" },
{ 0x00, 0, "VK_CONVERT" , NULL },