user32: Add a default VkKeyScanEx implementation.
This is basically the reverse of ToUnicodeEx. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4cf6023c62
commit
d1c2fadac4
|
@ -300,14 +300,7 @@ static void CDECL nulldrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
|
||||||
|
|
||||||
static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
|
static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
|
||||||
{
|
{
|
||||||
static const short ctrl_vks[] = {
|
return -256; /* use default implementation */
|
||||||
0x332, 0x241, 0x242, 0x003, 0x244, 0x245, 0x246, 0x247,
|
|
||||||
0x008, 0x009, 0x20d, 0x24b, 0x24c, 0x00d, 0x24e, 0x24f,
|
|
||||||
0x250, 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257,
|
|
||||||
0x258, 0x259, 0x25a, 0x01b, 0x2dc, 0x2dd, 0x336, 0x3bd
|
|
||||||
};
|
|
||||||
|
|
||||||
return ch < ARRAY_SIZE(ctrl_vks) ? ctrl_vks[ch] : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CDECL nulldrv_DestroyCursorIcon( HCURSOR cursor )
|
static void CDECL nulldrv_DestroyCursorIcon( HCURSOR cursor )
|
||||||
|
|
|
@ -674,9 +674,66 @@ WORD WINAPI VkKeyScanExA(CHAR cChar, HKL dwhkl)
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* VkKeyScanExW (USER32.@)
|
* VkKeyScanExW (USER32.@)
|
||||||
*/
|
*/
|
||||||
WORD WINAPI VkKeyScanExW(WCHAR cChar, HKL dwhkl)
|
WORD WINAPI VkKeyScanExW( WCHAR chr, HKL layout )
|
||||||
{
|
{
|
||||||
return USER_Driver->pVkKeyScanEx(cChar, dwhkl);
|
WORD shift = 0x100, ctrl = 0x200;
|
||||||
|
SHORT ret;
|
||||||
|
|
||||||
|
TRACE_(keyboard)( "chr %s, layout %p\n", debugstr_wn(&chr, 1), layout );
|
||||||
|
|
||||||
|
if ((ret = USER_Driver->pVkKeyScanEx( chr, layout )) != -256) return ret;
|
||||||
|
|
||||||
|
/* FIXME: English keyboard layout specific */
|
||||||
|
|
||||||
|
if (chr == VK_CANCEL || chr == VK_BACK || chr == VK_TAB || chr == VK_RETURN ||
|
||||||
|
chr == VK_ESCAPE || chr == VK_SPACE) ret = chr;
|
||||||
|
else if (chr >= '0' && chr <= '9') ret = chr;
|
||||||
|
else if (chr == ')') ret = shift + '0';
|
||||||
|
else if (chr == '!') ret = shift + '1';
|
||||||
|
else if (chr == '@') ret = shift + '2';
|
||||||
|
else if (chr == '#') ret = shift + '3';
|
||||||
|
else if (chr == '$') ret = shift + '4';
|
||||||
|
else if (chr == '%') ret = shift + '5';
|
||||||
|
else if (chr == '^') ret = shift + '6';
|
||||||
|
else if (chr == '&') ret = shift + '7';
|
||||||
|
else if (chr == '*') ret = shift + '8';
|
||||||
|
else if (chr == '(') ret = shift + '9';
|
||||||
|
else if (chr >= 'a' && chr <= 'z') ret = chr - 'a' + 'A';
|
||||||
|
else if (chr >= 'A' && chr <= 'Z') ret = shift + chr;
|
||||||
|
else if (chr == ';') ret = VK_OEM_1;
|
||||||
|
else if (chr == '=') ret = VK_OEM_PLUS;
|
||||||
|
else if (chr == ',') ret = VK_OEM_COMMA;
|
||||||
|
else if (chr == '-') ret = VK_OEM_MINUS;
|
||||||
|
else if (chr == '.') ret = VK_OEM_PERIOD;
|
||||||
|
else if (chr == '/') ret = VK_OEM_2;
|
||||||
|
else if (chr == '`') ret = VK_OEM_3;
|
||||||
|
else if (chr == '[') ret = VK_OEM_4;
|
||||||
|
else if (chr == '\\') ret = VK_OEM_5;
|
||||||
|
else if (chr == ']') ret = VK_OEM_6;
|
||||||
|
else if (chr == '\'') ret = VK_OEM_7;
|
||||||
|
else if (chr == ':') ret = shift + VK_OEM_1;
|
||||||
|
else if (chr == '+') ret = shift + VK_OEM_PLUS;
|
||||||
|
else if (chr == '<') ret = shift + VK_OEM_COMMA;
|
||||||
|
else if (chr == '_') ret = shift + VK_OEM_MINUS;
|
||||||
|
else if (chr == '>') ret = shift + VK_OEM_PERIOD;
|
||||||
|
else if (chr == '?') ret = shift + VK_OEM_2;
|
||||||
|
else if (chr == '~') ret = shift + VK_OEM_3;
|
||||||
|
else if (chr == '{') ret = shift + VK_OEM_4;
|
||||||
|
else if (chr == '|') ret = shift + VK_OEM_5;
|
||||||
|
else if (chr == '}') ret = shift + VK_OEM_6;
|
||||||
|
else if (chr == '\"') ret = shift + VK_OEM_7;
|
||||||
|
else if (chr == 0x7f) ret = ctrl + VK_BACK;
|
||||||
|
else if (chr == '\n') ret = ctrl + VK_RETURN;
|
||||||
|
else if (chr == 0xf000) ret = ctrl + '2';
|
||||||
|
else if (chr == 0x0000) ret = ctrl + shift + '2';
|
||||||
|
else if (chr >= 0x0001 && chr <= 0x001a) ret = ctrl + 'A' + chr - 1;
|
||||||
|
else if (chr >= 0x001c && chr <= 0x001d) ret = ctrl + VK_OEM_3 + chr;
|
||||||
|
else if (chr == 0x001e) ret = ctrl + shift + '6';
|
||||||
|
else if (chr == 0x001f) ret = ctrl + shift + VK_OEM_MINUS;
|
||||||
|
else ret = -1;
|
||||||
|
|
||||||
|
TRACE_(keyboard)( "ret %04x\n", ret );
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
|
Loading…
Reference in New Issue