add international keyboard support

This commit is contained in:
Chris Danford
2006-06-11 07:12:01 +00:00
parent b79cb92052
commit e2eb5135e5
5 changed files with 383 additions and 24 deletions
@@ -337,6 +337,35 @@ RString InputHandler_Carbon::GetDeviceSpecificInputString( const DeviceInput &di
return InputHandler::GetDeviceSpecificInputString( di );
}
wchar_t InputHandler_Carbon::DeviceButtonToChar( DeviceButton button, bool bUseCurrentKeyModifiers )
{
// Find the USB key code for this DeviceButton
UInt8 iMacVirtualKey;
if( KeyboardDevice::DeviceButtonToMacVirtualKey( button, iMacVirtualKey ) )
{
UInt32 modifiers = 0;
if( bUseCurrentKeyModifiers )
modifiers = GetCurrentKeyModifiers();
static unsigned long state = 0;
static Ptr keymap = nil;
Ptr new_keymap;
new_keymap = (Ptr)GetScriptManagerVariable(smKCHRCache);
if( new_keymap != keymap )
{
keymap = new_keymap;
state = 0;
}
// TODO: Use UCKeyTranslate
wchar_t ch = KeyTranslate( keymap, ((int)iMacVirtualKey)|modifiers, &state ) & 0xFFFF;
return ch;
}
return InputHandler::DeviceButtonToChar( button, bUseCurrentKeyModifiers );
}
/*
* (c) 2005, 2006 Steve Checkoway
* All rights reserved.