Fixed bug in OS X server key translation which pretty much broke any

keystroke with a modifier key.
This commit is contained in:
crs 2005-01-04 19:28:22 +00:00
parent 23ea82968d
commit 42b4e2488a
1 changed files with 5 additions and 7 deletions

View File

@ -432,11 +432,7 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids,
UInt32 modifiers; UInt32 modifiers;
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, GetEventParameter(event, kEventParamKeyModifiers, typeUInt32,
NULL, sizeof(modifiers), NULL, &modifiers); NULL, sizeof(modifiers), NULL, &modifiers);
modifiers &= ~(cmdKey | controlKey | rightControlKey); modifiers = (modifiers & ~(cmdKey | controlKey | rightControlKey)) >> 8;
// build keycode
UInt16 keycode =
static_cast<UInt16>((modifiers & 0xff00u) | (vkCode & 0x00ffu));
// choose action // choose action
UInt16 action; UInt16 action;
@ -456,8 +452,10 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids,
// translate key // translate key
UniCharCount count; UniCharCount count;
UniChar chars[2]; UniChar chars[2];
OSStatus status = UCKeyTranslate(m_uchrResource, keycode, action, OSStatus status = UCKeyTranslate(m_uchrResource,
modifiers, m_keyboardType, 0, &m_deadKeyState, vkCode & 0xffu, action,
modifiers & 0xffu,
m_keyboardType, 0, &m_deadKeyState,
sizeof(chars) / sizeof(chars[0]), &count, chars); sizeof(chars) / sizeof(chars[0]), &count, chars);
// get the characters // get the characters