diff options
author | rider <rider@lindenlab.com> | 2015-11-06 14:12:30 -0800 |
---|---|---|
committer | rider <rider@lindenlab.com> | 2015-11-06 14:12:30 -0800 |
commit | bd817f6f422991c2653493436c7845e75ea9d855 (patch) | |
tree | c0a7da3bf1cb6515ccc16b68534aa10c45a1ade6 /indra/llwindow/llwindowmacosx.cpp | |
parent | b1c3ec9c0049758afbe9e13d31cc2f60348ecffb (diff) |
MAINT-5754: Basic keyboard functionality on the Mac. Still incomplete
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rwxr-xr-x | indra/llwindow/llwindowmacosx.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 15e054fb5d..2a104c1877 100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -47,6 +47,10 @@ extern BOOL gDebugWindowProc; const S32 BITS_PER_PIXEL = 32; const S32 MAX_NUM_RESOLUTIONS = 32; +namespace +{ + NSKeyEventRef mRawKeyEvent = NULL; +} // // LLWindowMacOSX // @@ -194,14 +198,20 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, // These functions are used as wrappers for our internal event handling callbacks. // It's a good idea to wrap these to avoid reworking more code than we need to within LLWindow. -bool callKeyUp(unsigned short key, unsigned int mask) +bool callKeyUp(NSKeyEventRef event, unsigned short key, unsigned int mask) { - return gKeyboard->handleKeyUp(key, mask); + mRawKeyEvent = event; + bool retVal = gKeyboard->handleKeyUp(key, mask); + mRawKeyEvent = NULL; + return retVal; } -bool callKeyDown(unsigned short key, unsigned int mask) +bool callKeyDown(NSKeyEventRef event, unsigned short key, unsigned int mask) { - return gKeyboard->handleKeyDown(key, mask); + mRawKeyEvent = event; + bool retVal = gKeyboard->handleKeyDown(key, mask); + mRawKeyEvent = NULL; + return retVal; } void callResetKeys() @@ -1713,23 +1723,15 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) LLSD LLWindowMacOSX::getNativeKeyData() { LLSD result = LLSD::emptyMap(); -#if 0 +#if 1 if(mRawKeyEvent) { - char char_code = 0; - UInt32 key_code = 0; - UInt32 modifiers = 0; - UInt32 keyboard_type = 0; - - GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code); - GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code); - GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); - GetEventParameter (mRawKeyEvent, kEventParamKeyboardType, typeUInt32, NULL, sizeof(UInt32), NULL, &keyboard_type); - result["char_code"] = (S32)char_code; - result["key_code"] = (S32)key_code; - result["modifiers"] = (S32)modifiers; - result["keyboard_type"] = (S32)keyboard_type; + result["char_code"] = (S32)(mRawKeyEvent)->mCharacter; + result["scan_code"] = (S32)(mRawKeyEvent)->mScanCode; + result["key_code"] = (S32)(mRawKeyEvent->mKeyCode); + result["modifiers"] = (S32)(mRawKeyEvent->mKeyModifiers); + result["keyboard_type"] = (S32)(mRawKeyEvent->mKeyboardType); #if 0 // This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc) |