wineandroid: Implement MapVirtualKeyEx.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Josh DuBois 2017-06-09 09:20:20 +02:00 committed by Alexandre Julliard
parent 86534e0dd5
commit 0d565d0118
2 changed files with 65 additions and 0 deletions

View File

@ -36,6 +36,7 @@
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
WINE_DECLARE_DEBUG_CHANNEL(key);
static const UINT keycode_to_vkey[] =
{
@ -821,3 +822,66 @@ INT CDECL ANDROID_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
TRACE( "lparam 0x%08x -> %s\n", lparam, debugstr_w( buffer ));
return len;
}
/***********************************************************************
* ANDROID_MapVirtualKeyEx
*/
UINT CDECL ANDROID_MapVirtualKeyEx( UINT code, UINT maptype, HKL hkl )
{
UINT ret = 0;
const char *s;
TRACE_(key)( "code=0x%x, maptype=%d, hkl %p\n", code, maptype, hkl );
switch (maptype)
{
case MAPVK_VK_TO_VSC_EX:
case MAPVK_VK_TO_VSC:
/* vkey to scancode */
switch (code)
{
case VK_SHIFT:
code = VK_LSHIFT;
break;
case VK_CONTROL:
code = VK_LCONTROL;
break;
case VK_MENU:
code = VK_LMENU;
break;
}
if (code < sizeof(vkey_to_scancode) / sizeof(vkey_to_scancode[0])) ret = vkey_to_scancode[code];
break;
case MAPVK_VSC_TO_VK:
case MAPVK_VSC_TO_VK_EX:
/* scancode to vkey */
ret = scancode_to_vkey( code );
if (maptype == 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:
s = vkey_to_name( code );
if (s && (strlen( s ) == 1))
ret = s[0];
else
ret = 0;
break;
default:
FIXME( "Unknown maptype %d\n", maptype );
break;
}
TRACE_(key)( "returning 0x%04x\n", ret );
return ret;
}

View File

@ -5,6 +5,7 @@
# USER driver
@ cdecl GetKeyNameText(long ptr long) ANDROID_GetKeyNameText
@ cdecl MapVirtualKeyEx(long long long) ANDROID_MapVirtualKeyEx
@ cdecl ToUnicodeEx(long long ptr ptr long long long) ANDROID_ToUnicodeEx
@ cdecl EnumDisplayMonitors(long ptr ptr long) ANDROID_EnumDisplayMonitors
@ cdecl GetMonitorInfo(long ptr) ANDROID_GetMonitorInfo