user32: Support Japanese keyboard type in GetKeyboardType.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2018-08-17 17:14:49 +09:00 committed by Alexandre Julliard
parent 8743188f5d
commit c6d28c9399
1 changed files with 32 additions and 10 deletions

View File

@ -917,6 +917,28 @@ DWORD WINAPI OemKeyScan( WORD oem )
INT WINAPI GetKeyboardType(INT nTypeFlag) INT WINAPI GetKeyboardType(INT nTypeFlag)
{ {
TRACE_(keyboard)("(%d)\n", nTypeFlag); TRACE_(keyboard)("(%d)\n", nTypeFlag);
if (LOWORD(GetKeyboardLayout(0)) == MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN))
{
/* scan code for `_', the key left of r-shift, in Japanese 106 keyboard */
const UINT JP106_VSC_USCORE = 0x73;
switch(nTypeFlag)
{
case 0: /* Keyboard type */
return 7; /* Japanese keyboard */
case 1: /* Keyboard Subtype */
/* Test keyboard mappings to detect Japanese keyboard */
if (MapVirtualKeyW(VK_OEM_102, MAPVK_VK_TO_VSC) == JP106_VSC_USCORE
&& MapVirtualKeyW(JP106_VSC_USCORE, MAPVK_VSC_TO_VK) == VK_OEM_102)
return 2; /* Japanese 106 */
else
return 0; /* AT-101 */
case 2: /* Number of F-keys */
return 12; /* It has 12 F-keys */
}
}
else
{
switch(nTypeFlag) switch(nTypeFlag)
{ {
case 0: /* Keyboard type */ case 0: /* Keyboard type */
@ -925,11 +947,11 @@ INT WINAPI GetKeyboardType(INT nTypeFlag)
return 0; /* There are no defined subtypes */ return 0; /* There are no defined subtypes */
case 2: /* Number of F-keys */ case 2: /* Number of F-keys */
return 12; /* We're doing an 101 for now, so return 12 F-keys */ return 12; /* We're doing an 101 for now, so return 12 F-keys */
default: }
}
WARN_(keyboard)("Unknown type\n"); WARN_(keyboard)("Unknown type\n");
return 0; /* The book says 0 here, so 0 */ return 0; /* The book says 0 here, so 0 */
} }
}
/****************************************************************************** /******************************************************************************
* MapVirtualKeyA (USER32.@) * MapVirtualKeyA (USER32.@)