diff options
author | rider <rider@lindenlab.com> | 2015-11-13 16:22:34 -0800 |
---|---|---|
committer | rider <rider@lindenlab.com> | 2015-11-13 16:22:34 -0800 |
commit | c2ad041c23b0097aec30acc7447a42f96d515d3b (patch) | |
tree | 6d3632e4ef5e9b9bdae8aeb34f0b4839531464fc /indra/llwindow/llopenglview-objc.mm | |
parent | a9a3cafa9194794850f97bec15e1d176389dd7eb (diff) |
Encode keyboard event for reconstruction in the plugin.
Diffstat (limited to 'indra/llwindow/llopenglview-objc.mm')
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 81e90accb7..406bc9cf47 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -30,13 +30,6 @@ -//--------------------------- -// Coppied from indra_constants.h -//#include "indra_constats.h" -const uint32_t MASK_CONTROL = 0x0001; // Mapped to cmd on Macs -const uint32_t MASK_ALT = 0x0002; -const uint32_t MASK_SHIFT = 0x0004; -//const uint32_t MASK_MAC_CONTROL = 0x0008; // Un-mapped Ctrl key on Macs, not used on Windows //--------------------------- @@ -72,29 +65,16 @@ const uint32_t MASK_SHIFT = 0x0004; void extractKeyDataFromEvent (NSEvent *theEvent, NativeKeyEventData * eventData) { - if ([theEvent characters].length) - { - eventData->mCharacter = (wchar_t)[[theEvent characters] characterAtIndex:0]; - } - else - { - eventData->mCharacter = [theEvent keyCode]; - } eventData->mKeyEvent = NativeKeyEventData::KEYUNKNOWN; - eventData->mKeyCode = [theEvent keyCode]; + eventData->mEventType = [theEvent type]; + eventData->mEventModifiers = [theEvent modifierFlags]; + eventData->mEventKeyCode = [theEvent keyCode]; + NSString *strEventChars = [theEvent characters]; + eventData->mEventChars = (strEventChars.length) ? [strEventChars characterAtIndex:0] : 0; + NSString *strEventUChars = [theEvent charactersIgnoringModifiers]; + eventData->mEventUnmodChars = (strEventUChars.length) ? [strEventUChars characterAtIndex:0] : 0; + eventData->mEventRepeat = [theEvent isARepeat]; - unsigned int modifiers = [theEvent modifierFlags]; - - if (modifiers & (NSAlphaShiftKeyMask | NSShiftKeyMask)) - modifiers |= MASK_SHIFT; - if (modifiers & NSAlternateKeyMask) - modifiers |= MASK_ALT; - if (modifiers & NSControlKeyMask) - modifiers |= MASK_CONTROL; - - eventData->mKeyModifiers = modifiers; - eventData->mScanCode = [theEvent keyCode ]; - eventData->mKeyboardType = 0; } |