Commit 8d343538 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserMapVirtualKeyEx implementation from user32.

parent 8f52632c
......@@ -253,11 +253,6 @@ static UINT CDECL loaderdrv_GetKeyboardLayoutList( INT size, HKL *layouts )
return load_driver()->pGetKeyboardLayoutList( size, layouts );
}
static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
{
return load_driver()->pMapVirtualKeyEx( code, type, layout );
}
static BOOL CDECL loaderdrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
{
return load_driver()->pRegisterHotKey( hwnd, modifiers, vk );
......@@ -365,7 +360,7 @@ static struct user_driver_funcs lazy_load_driver =
loaderdrv_Beep,
loaderdrv_GetKeyNameText,
loaderdrv_GetKeyboardLayoutList,
loaderdrv_MapVirtualKeyEx,
NULL,
loaderdrv_RegisterHotKey,
loaderdrv_ToUnicodeEx,
loaderdrv_UnregisterHotKey,
......
......@@ -717,7 +717,7 @@ UINT WINAPI MapVirtualKeyA(UINT code, UINT maptype)
*/
UINT WINAPI MapVirtualKeyW(UINT code, UINT maptype)
{
return MapVirtualKeyExW(code, maptype, GetKeyboardLayout(0));
return NtUserMapVirtualKeyEx( code, maptype, GetKeyboardLayout(0) );
}
/******************************************************************************
......@@ -727,7 +727,7 @@ UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl)
{
UINT ret;
ret = MapVirtualKeyExW( code, maptype, hkl );
ret = NtUserMapVirtualKeyEx( code, maptype, hkl );
if (maptype == MAPVK_VK_TO_CHAR)
{
BYTE ch = 0;
......@@ -795,26 +795,6 @@ static const UINT kbd_en_vsc2vk[] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const UINT kbd_en_vk2char[] =
{
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00,
' ', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 0x00, 0x00, 0x00, 0x00, 0x00,
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '+', 0x00, '-', '.', '/',
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ';', '=', ',', '-', '.', '/',
'`', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, '[', '\\', ']', '\'', 0x00,
0x00, 0x00, '\\', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const WCHAR *kbd_en_vscname[] =
{
0, L"Esc", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Backspace", L"Tab",
......@@ -852,88 +832,6 @@ static const WCHAR *kbd_en_vscname[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
/******************************************************************************
* MapVirtualKeyExW (USER32.@)
*/
UINT WINAPI MapVirtualKeyExW( UINT code, UINT type, HKL layout )
{
const UINT *vsc2vk, *vk2char;
UINT vsc2vk_size, vk2char_size;
UINT ret;
TRACE_(keyboard)( "code %u, type %u, layout %p.\n", code, type, layout );
if ((ret = USER_Driver->pMapVirtualKeyEx( code, type, layout )) != -1) return ret;
/* FIXME: English keyboard layout specific */
vsc2vk = kbd_en_vsc2vk;
vsc2vk_size = ARRAYSIZE(kbd_en_vsc2vk);
vk2char = kbd_en_vk2char;
vk2char_size = ARRAYSIZE(kbd_en_vk2char);
switch (type)
{
case MAPVK_VK_TO_VSC_EX:
case MAPVK_VK_TO_VSC:
switch (code)
{
case VK_SHIFT: code = VK_LSHIFT; break;
case VK_CONTROL: code = VK_LCONTROL; break;
case VK_MENU: code = VK_LMENU; break;
case VK_NUMPAD0: code = VK_INSERT; break;
case VK_NUMPAD1: code = VK_END; break;
case VK_NUMPAD2: code = VK_DOWN; break;
case VK_NUMPAD3: code = VK_NEXT; break;
case VK_NUMPAD4: code = VK_LEFT; break;
case VK_NUMPAD5: code = VK_CLEAR; break;
case VK_NUMPAD6: code = VK_RIGHT; break;
case VK_NUMPAD7: code = VK_HOME; break;
case VK_NUMPAD8: code = VK_UP; break;
case VK_NUMPAD9: code = VK_PRIOR; break;
case VK_DECIMAL: code = VK_DELETE; break;
}
for (ret = 0; ret < vsc2vk_size; ++ret) if (vsc2vk[ret] == code) break;
if (ret >= vsc2vk_size) ret = 0;
if (type == MAPVK_VK_TO_VSC)
{
if (ret >= 0x200) ret = 0;
else ret &= 0xff;
}
else if (ret >= 0x100) ret += 0xdf00;
break;
case MAPVK_VSC_TO_VK:
case MAPVK_VSC_TO_VK_EX:
if (code & 0xe000) code -= 0xdf00;
if (code >= vsc2vk_size) ret = 0;
else ret = vsc2vk[code];
if (type == MAPVK_VSC_TO_VK)
{
switch (ret)
{
case VK_LSHIFT: case VK_RSHIFT: ret = VK_SHIFT; break;
case VK_LCONTROL: case VK_RCONTROL: ret = VK_CONTROL; break;
case VK_LMENU: case VK_RMENU: ret = VK_MENU; break;
}
}
break;
case MAPVK_VK_TO_CHAR:
if (code >= vk2char_size) ret = 0;
else ret = vk2char[code];
break;
default:
FIXME_(keyboard)( "unknown type %d\n", type );
return 0;
}
TRACE_(keyboard)( "returning 0x%04x\n", ret );
return ret;
}
/****************************************************************************
* GetKBCodePage (USER32.@)
*/
......
......@@ -521,7 +521,7 @@
@ stdcall MapDialogRect(long ptr)
@ stdcall MapVirtualKeyA(long long)
@ stdcall MapVirtualKeyExA(long long long)
@ stdcall MapVirtualKeyExW(long long long)
@ stdcall MapVirtualKeyExW(long long long) NtUserMapVirtualKeyEx
@ stdcall MapVirtualKeyW(long long)
@ stdcall MapWindowPoints(long long ptr long)
@ stdcall MenuItemFromPoint(long long int64)
......
......@@ -1003,6 +1003,11 @@ static const struct user_driver_funcs *load_driver(void)
return user_driver;
}
static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
{
return load_driver()->pMapVirtualKeyEx( code, type, layout );
}
static SHORT CDECL loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
{
return load_driver()->pVkKeyScanEx( ch, layout );
......@@ -1015,6 +1020,7 @@ static void CDECL loaderdrv_UpdateClipboard(void)
static const struct user_driver_funcs lazy_load_driver =
{
.pMapVirtualKeyEx = loaderdrv_MapVirtualKeyEx,
.pVkKeyScanEx = loaderdrv_VkKeyScanEx,
.pUpdateClipboard = loaderdrv_UpdateClipboard,
};
......
......@@ -1171,6 +1171,7 @@ static struct unix_funcs unix_funcs =
NtUserGetPriorityClipboardFormat,
NtUserGetUpdatedClipboardFormats,
NtUserIsClipboardFormatAvailable,
NtUserMapVirtualKeyEx,
NtUserVkKeyScanEx,
GDIRealizePalette,
......
......@@ -175,3 +175,159 @@ WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout )
TRACE_(keyboard)( "ret %04x\n", ret );
return ret;
}
/* English keyboard layout (0x0409) */
static const UINT kbd_en_vsc2vk[] =
{
0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0xbd, 0xbb, 0x08, 0x09,
0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0xdb, 0xdd, 0x0d, 0xa2, 0x41, 0x53,
0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0xba, 0xde, 0xc0, 0xa0, 0xdc, 0x5a, 0x58, 0x43, 0x56,
0x42, 0x4e, 0x4d, 0xbc, 0xbe, 0xbf, 0xa1, 0x6a, 0xa4, 0x20, 0x14, 0x70, 0x71, 0x72, 0x73, 0x74,
0x75, 0x76, 0x77, 0x78, 0x79, 0x90, 0x91, 0x24, 0x26, 0x21, 0x6d, 0x25, 0x0c, 0x27, 0x6b, 0x23,
0x28, 0x22, 0x2d, 0x2e, 0x2c, 0x00, 0xe2, 0x7a, 0x7b, 0x0c, 0xee, 0xf1, 0xea, 0xf9, 0xf5, 0xf3,
0x00, 0x00, 0xfb, 0x2f, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xed,
0x00, 0xe9, 0x00, 0xc1, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x09, 0x00, 0xc2, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0xe000 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x0d, 0xa3, 0x00, 0x00,
0xad, 0xb7, 0xb3, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00,
0xaf, 0x00, 0xac, 0x00, 0x00, 0x6f, 0x00, 0x2c, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x24, 0x26, 0x21, 0x00, 0x25, 0x00, 0x27, 0x00, 0x23,
0x28, 0x22, 0x2d, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5c, 0x5d, 0x00, 0x5f,
0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xab, 0xa8, 0xa9, 0xa7, 0xa6, 0xb6, 0xb4, 0xb5, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0xe100 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const UINT kbd_en_vk2char[] =
{
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00,
' ', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 0x00, 0x00, 0x00, 0x00, 0x00,
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '+', 0x00, '-', '.', '/',
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ';', '=', ',', '-', '.', '/',
'`', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, '[', '\\', ']', '\'', 0x00,
0x00, 0x00, '\\', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/******************************************************************************
* NtUserMapVirtualKeyEx (win32u.@)
*/
UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout )
{
const UINT *vsc2vk, *vk2char;
UINT vsc2vk_size, vk2char_size;
UINT ret;
TRACE_(keyboard)( "code %u, type %u, layout %p.\n", code, type, layout );
if ((ret = user_driver->pMapVirtualKeyEx( code, type, layout )) != -1) return ret;
/* FIXME: English keyboard layout specific */
vsc2vk = kbd_en_vsc2vk;
vsc2vk_size = ARRAYSIZE(kbd_en_vsc2vk);
vk2char = kbd_en_vk2char;
vk2char_size = ARRAYSIZE(kbd_en_vk2char);
switch (type)
{
case MAPVK_VK_TO_VSC_EX:
case MAPVK_VK_TO_VSC:
switch (code)
{
case VK_SHIFT: code = VK_LSHIFT; break;
case VK_CONTROL: code = VK_LCONTROL; break;
case VK_MENU: code = VK_LMENU; break;
case VK_NUMPAD0: code = VK_INSERT; break;
case VK_NUMPAD1: code = VK_END; break;
case VK_NUMPAD2: code = VK_DOWN; break;
case VK_NUMPAD3: code = VK_NEXT; break;
case VK_NUMPAD4: code = VK_LEFT; break;
case VK_NUMPAD5: code = VK_CLEAR; break;
case VK_NUMPAD6: code = VK_RIGHT; break;
case VK_NUMPAD7: code = VK_HOME; break;
case VK_NUMPAD8: code = VK_UP; break;
case VK_NUMPAD9: code = VK_PRIOR; break;
case VK_DECIMAL: code = VK_DELETE; break;
}
for (ret = 0; ret < vsc2vk_size; ++ret) if (vsc2vk[ret] == code) break;
if (ret >= vsc2vk_size) ret = 0;
if (type == MAPVK_VK_TO_VSC)
{
if (ret >= 0x200) ret = 0;
else ret &= 0xff;
}
else if (ret >= 0x100) ret += 0xdf00;
break;
case MAPVK_VSC_TO_VK:
case MAPVK_VSC_TO_VK_EX:
if (code & 0xe000) code -= 0xdf00;
if (code >= vsc2vk_size) ret = 0;
else ret = vsc2vk[code];
if (type == MAPVK_VSC_TO_VK)
{
switch (ret)
{
case VK_LSHIFT: case VK_RSHIFT: ret = VK_SHIFT; break;
case VK_LCONTROL: case VK_RCONTROL: ret = VK_CONTROL; break;
case VK_LMENU: case VK_RMENU: ret = VK_MENU; break;
}
}
break;
case MAPVK_VK_TO_CHAR:
if (code >= vk2char_size) ret = 0;
else ret = vk2char[code];
break;
default:
FIXME_(keyboard)( "unknown type %d\n", type );
return 0;
}
TRACE_(keyboard)( "returning 0x%04x\n", ret );
return ret;
}
......@@ -1076,7 +1076,7 @@
@ stub NtUserMagGetContextInformation
@ stub NtUserMagSetContextInformation
@ stub NtUserMapPointsByVisualIdentifier
@ stub NtUserMapVirtualKeyEx
@ stdcall NtUserMapVirtualKeyEx(long long long)
@ stub NtUserMarkWindowForRawMouse
@ stub NtUserMenuItemFromPoint
@ stub NtUserMessageCall
......
......@@ -198,6 +198,7 @@ struct unix_funcs
INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count );
BOOL (WINAPI *pNtUserGetUpdatedClipboardFormats)( UINT *formats, UINT size, UINT *out_size );
BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format );
UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout );
WORD (WINAPI *pNtUserVkKeyScanEx)( WCHAR chr, HKL layout );
/* Wine-specific functions */
......
......@@ -616,6 +616,11 @@ BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format )
return unix_funcs->pNtUserIsClipboardFormatAvailable( format );
}
UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout )
{
return unix_funcs->pNtUserMapVirtualKeyEx( code, type, layout );
}
WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout )
{
return unix_funcs->pNtUserVkKeyScanEx( chr, layout );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment