forked from Mirrors/wine-wine
winemac: Implement VkKeyScanEx().
parent
a649d845ed
commit
80baa3a0e9
|
@ -1087,3 +1087,76 @@ done:
|
||||||
TRACE_(key)("returning %d / %s\n", ret, debugstr_wn(bufW, abs(ret)));
|
TRACE_(key)("returning %d / %s\n", ret, debugstr_wn(bufW, abs(ret)));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* VkKeyScanEx (MACDRV.@)
|
||||||
|
*
|
||||||
|
* Note: Windows ignores HKL parameter and uses current active layout instead
|
||||||
|
*/
|
||||||
|
SHORT CDECL macdrv_VkKeyScanEx(WCHAR wChar, HKL hkl)
|
||||||
|
{
|
||||||
|
struct macdrv_thread_data *thread_data = macdrv_init_thread_data();
|
||||||
|
SHORT ret = -1;
|
||||||
|
int state;
|
||||||
|
const UCKeyboardLayout *uchr;
|
||||||
|
|
||||||
|
TRACE("%04x, %p\n", wChar, hkl);
|
||||||
|
|
||||||
|
uchr = (const UCKeyboardLayout*)CFDataGetBytePtr(thread_data->keyboard_layout_uchr);
|
||||||
|
if (!uchr)
|
||||||
|
{
|
||||||
|
TRACE("no keyboard layout UCHR data; returning -1\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (state = 0; state < 8; state++)
|
||||||
|
{
|
||||||
|
UInt32 modifierKeyState = 0;
|
||||||
|
int keyc;
|
||||||
|
|
||||||
|
if (state & 1)
|
||||||
|
modifierKeyState |= (shiftKey >> 8);
|
||||||
|
if ((state & 6) == 6)
|
||||||
|
modifierKeyState |= (optionKey >> 8);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (state & 2)
|
||||||
|
modifierKeyState |= (controlKey >> 8);
|
||||||
|
if (state & 4)
|
||||||
|
modifierKeyState |= (cmdKey >> 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (keyc = 0; keyc < sizeof(thread_data->keyc2vkey) / sizeof(thread_data->keyc2vkey[0]); keyc++)
|
||||||
|
{
|
||||||
|
UInt32 deadKeyState = 0;
|
||||||
|
UniChar uchar;
|
||||||
|
UniCharCount len;
|
||||||
|
OSStatus status;
|
||||||
|
|
||||||
|
if (!thread_data->keyc2vkey[keyc]) continue;
|
||||||
|
|
||||||
|
status = UCKeyTranslate(uchr, keyc, kUCKeyActionDown, modifierKeyState,
|
||||||
|
thread_data->keyboard_type, 0, &deadKeyState,
|
||||||
|
1, &len, &uchar);
|
||||||
|
if (status == noErr && len == 1 && uchar == wChar)
|
||||||
|
{
|
||||||
|
WORD vkey = thread_data->keyc2vkey[keyc];
|
||||||
|
|
||||||
|
ret = vkey | (state << 8);
|
||||||
|
if ((VK_NUMPAD0 <= vkey && vkey <= VK_DIVIDE) ||
|
||||||
|
keyc == kVK_ANSI_KeypadClear || keyc == kVK_ANSI_KeypadEnter ||
|
||||||
|
keyc == kVK_ANSI_KeypadEquals)
|
||||||
|
{
|
||||||
|
/* Keep searching for a non-numpad match, which is preferred. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
TRACE(" -> 0x%04x\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
@ cdecl ShowWindow(long long ptr long) macdrv_ShowWindow
|
@ cdecl ShowWindow(long long ptr long) macdrv_ShowWindow
|
||||||
@ cdecl ToUnicodeEx(long long ptr ptr long long long) macdrv_ToUnicodeEx
|
@ cdecl ToUnicodeEx(long long ptr ptr long long long) macdrv_ToUnicodeEx
|
||||||
@ cdecl UpdateLayeredWindow(long ptr ptr) macdrv_UpdateLayeredWindow
|
@ cdecl UpdateLayeredWindow(long ptr ptr) macdrv_UpdateLayeredWindow
|
||||||
|
@ cdecl VkKeyScanEx(long long) macdrv_VkKeyScanEx
|
||||||
@ cdecl WindowMessage(long long long long) macdrv_WindowMessage
|
@ cdecl WindowMessage(long long long long) macdrv_WindowMessage
|
||||||
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) macdrv_WindowPosChanged
|
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) macdrv_WindowPosChanged
|
||||||
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) macdrv_WindowPosChanging
|
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) macdrv_WindowPosChanging
|
||||||
|
|
Loading…
Reference in New Issue