Module: wine Branch: master Commit: 5bb094c9a21d078d4fec26ef45529e84f3f73e75 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5bb094c9a21d078d4fec26ef45...
Author: Vitaliy Margolen wine-patches@kievinfo.com Date: Tue Nov 8 10:59:20 2011 -0700
dinput: Return correct key names for num_lock and pause.
Scan codes and DIK codes for num_lock and pause are reversed.
---
dlls/dinput/keyboard.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index c23a023..3ca7d97 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -410,12 +410,14 @@ SysKeyboardAImpl_GetObjectInfo( DWORD dwHow) { HRESULT res; + LONG scan;
res = IDirectInputDevice2AImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow); if (res != DI_OK) return res;
- if (!GetKeyNameTextA((DIDFT_GETINSTANCE(pdidoi->dwType) & 0x80) << 17 | - (DIDFT_GETINSTANCE(pdidoi->dwType) & 0x7f) << 16, + scan = DIDFT_GETINSTANCE(pdidoi->dwType); + if (scan == DIK_PAUSE || scan == DIK_NUMLOCK) scan ^= 0x80; + if (!GetKeyNameTextA((scan & 0x80) << 17 | (scan & 0x7f) << 16, pdidoi->tszName, sizeof(pdidoi->tszName))) return DIERR_OBJECTNOTFOUND;
@@ -429,14 +431,15 @@ static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface DWORD dwHow) { HRESULT res; + LONG scan;
res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow); if (res != DI_OK) return res;
- if (!GetKeyNameTextW((DIDFT_GETINSTANCE(pdidoi->dwType) & 0x80) << 17 | - (DIDFT_GETINSTANCE(pdidoi->dwType) & 0x7f) << 16, - pdidoi->tszName, - sizeof(pdidoi->tszName)/sizeof(pdidoi->tszName[0]))) + scan = DIDFT_GETINSTANCE(pdidoi->dwType); + if (scan == DIK_PAUSE || scan == DIK_NUMLOCK) scan ^= 0x80; + if (!GetKeyNameTextW((scan & 0x80) << 17 | (scan & 0x7f) << 16, + pdidoi->tszName, sizeof(pdidoi->tszName))) return DIERR_OBJECTNOTFOUND;
_dump_OBJECTINSTANCEW(pdidoi);