mirror of
https://github.com/AxioDL/boo.git
synced 2025-05-16 12:21:25 +00:00
cleaner OS X character handling
This commit is contained in:
parent
30fd4c0709
commit
e21074ce57
@ -978,14 +978,19 @@ static boo::ESpecialKey translateKeycode(short code)
|
|||||||
if (!booContext->m_callback)
|
if (!booContext->m_callback)
|
||||||
return;
|
return;
|
||||||
boo::ESpecialKey special = translateKeycode(theEvent.keyCode);
|
boo::ESpecialKey special = translateKeycode(theEvent.keyCode);
|
||||||
NSString* chars = theEvent.characters;
|
boo::EModifierKey mods = getMod(theEvent.modifierFlags);
|
||||||
|
NSString* chars;
|
||||||
|
if ((mods & boo::EModifierKey::Ctrl) != boo::EModifierKey::None)
|
||||||
|
chars = theEvent.charactersIgnoringModifiers;
|
||||||
|
else
|
||||||
|
chars = theEvent.characters;
|
||||||
if (special != boo::ESpecialKey::None)
|
if (special != boo::ESpecialKey::None)
|
||||||
booContext->m_callback->specialKeyDown(special,
|
booContext->m_callback->specialKeyDown(special,
|
||||||
getMod(theEvent.modifierFlags),
|
mods,
|
||||||
theEvent.isARepeat);
|
theEvent.isARepeat);
|
||||||
else if ([chars length])
|
else if ([chars length])
|
||||||
booContext->m_callback->charKeyDown([chars characterAtIndex:0],
|
booContext->m_callback->charKeyDown([chars characterAtIndex:0],
|
||||||
getMod(theEvent.modifierFlags),
|
mods,
|
||||||
theEvent.isARepeat);
|
theEvent.isARepeat);
|
||||||
[textContext handleEvent:theEvent];
|
[textContext handleEvent:theEvent];
|
||||||
}
|
}
|
||||||
@ -995,13 +1000,18 @@ static boo::ESpecialKey translateKeycode(short code)
|
|||||||
if (!booContext->m_callback)
|
if (!booContext->m_callback)
|
||||||
return;
|
return;
|
||||||
boo::ESpecialKey special = translateKeycode(theEvent.keyCode);
|
boo::ESpecialKey special = translateKeycode(theEvent.keyCode);
|
||||||
NSString* chars = theEvent.characters;
|
boo::EModifierKey mods = getMod(theEvent.modifierFlags);
|
||||||
|
NSString* chars;
|
||||||
|
if ((mods & boo::EModifierKey::Ctrl) != boo::EModifierKey::None)
|
||||||
|
chars = theEvent.charactersIgnoringModifiers;
|
||||||
|
else
|
||||||
|
chars = theEvent.characters;
|
||||||
if (special != boo::ESpecialKey::None)
|
if (special != boo::ESpecialKey::None)
|
||||||
booContext->m_callback->specialKeyUp(special,
|
booContext->m_callback->specialKeyUp(special,
|
||||||
getMod(theEvent.modifierFlags));
|
mods);
|
||||||
else if ([chars length])
|
else if ([chars length])
|
||||||
booContext->m_callback->charKeyUp([chars characterAtIndex:0],
|
booContext->m_callback->charKeyUp([chars characterAtIndex:0],
|
||||||
getMod(theEvent.modifierFlags));
|
mods);
|
||||||
//[textContext handleEvent:theEvent];
|
//[textContext handleEvent:theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user