Hi,
I compiled version 1.3.1 and meshviewer sample (as is) in mac OSX 10.4 - intel
I tried to type in a number with a period (i.e. "0.5") to the scale textboxes on the right. When pressing the period button nothing happened. I debugged the code and it seems that that the function [str cStringUsingEncoding:NSWindowsCP1251StringEncoding] doesn't encode the period character correctly. Here is a quick fix for the problem:
replace the following function in CIrrDeviceMacOSX.mm
void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed)
{
NSString *str;
std::map<int,int>::const_iterator iter;
unsigned int result,c,mkey,mchar;
const unsigned char *cStr;
BOOL skipCommand;
str = [event characters];
if (str != nil && [str length] > 0)
{
mkey = mchar = 0;
skipCommand = false;
c = [str characterAtIndex:0];
iter = _keycodes.find(c);
if (iter != _keycodes.end()) mkey = (*iter).second;
else
{
// workaround for period character
if (c == 0x2E)
{
mkey = irr::KEY_PERIOD;
mchar = '.';
}
else
{
cStr = (unsigned char *)[str cStringUsingEncoding:NSWindowsCP1251StringEncoding];
if (cStr != NULL && strlen((char*)cStr) > 0)
{
mchar = cStr[0];
mkey = toupper(mchar);
if ([event modifierFlags] & NSCommandKeyMask)
{
if (mkey == 'C' || mkey == 'V' || mkey == 'X')
{
mchar = 0;
skipCommand = true;
}
}
}
}
}
ievent.EventType = irr::EET_KEY_INPUT_EVENT;
ievent.KeyInput.Key = (irr::EKEY_CODE)mkey;
ievent.KeyInput.PressedDown = pressed;
ievent.KeyInput.Shift = ([event modifierFlags] & NSShiftKeyMask) != 0;
ievent.KeyInput.Control = ([event modifierFlags] & NSControlKeyMask) != 0;
ievent.KeyInput.Char = (irr::EKEY_CODE)mchar;
if (skipCommand) ievent.KeyInput.Control = true;
else if ([event modifierFlags] & NSCommandKeyMask) [NSApp sendEvent:(NSEvent *)event];
postEventFromUser(ievent);
}
}
Thanks-
Ori Hanegby