From e92e72ff3a2c0d0d95cb866f9567a2146bc8dbfa Mon Sep 17 00:00:00 2001 From: pavelk_productengine Date: Fri, 24 Apr 2015 23:24:44 +0300 Subject: MAINT-5106 FIXED [MAC] if SL viewer is not running, clicking on SLURL launches viewer, BUT start location is not set --- indra/llwindow/llwindowmacosx-objc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index f02052ca6a..e6e8f27f53 100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -53,6 +53,7 @@ bool runMainLoop(); void initMainLoop(); void cleanupViewer(); void handleUrl(const char* url); +void dispatchUrl(std::string url); /* Defined in llwindowmacosx-objc.mm: */ int createNSApp(int argc, const char **argv); -- cgit v1.2.3 From 078612e292fa8b66a8b7a68b7e1fe9b5049c3deb Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Tue, 14 Jul 2015 04:39:20 +0300 Subject: MAINT-5019 FIXED Additional cases --- indra/llwindow/llwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 5720660034..1b24250618 100755 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -49,8 +49,8 @@ LLSplashScreen *gSplashScreenp = NULL; BOOL gDebugClicks = FALSE; BOOL gDebugWindowProc = FALSE; -const S32 gURLProtocolWhitelistCount = 4; -const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:" }; +const S32 gURLProtocolWhitelistCount = 5; +const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:", "mailto:" }; // CP: added a handler list - this is what's used to open the protocol and is based on registry entry // only meaningful difference currently is that file: protocols are opened using http: -- cgit v1.2.3 From 83a9ae7b3c66e87179362f0da9fa7a378b1527e2 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 15 Jul 2015 02:27:33 +0100 Subject: New keyboard code for windows that uses system messages directly and works ok. Points to new LLCEFLib --- indra/llwindow/llwindowwin32.cpp | 13 +++++++++++++ indra/llwindow/llwindowwin32.h | 3 +++ 2 files changed, 16 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index cd2be87fad..7503d95263 100755 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -42,6 +42,7 @@ #include "llgl.h" #include "llstring.h" #include "lldir.h" +#include "llsdutil.h" #include "llglslshader.h" // System includes @@ -2068,6 +2069,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mKeyCharCode = 0; // don't know until wm_char comes in next window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff; window_imp->mKeyVirtualKey = w_param; + window_imp->mRawMsg = u_msg; + window_imp->mRawWParam = w_param; + window_imp->mRawLParam = l_param; window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYDOWN"); { @@ -2090,6 +2094,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff; window_imp->mKeyVirtualKey = w_param; + window_imp->mRawMsg = u_msg; + window_imp->mRawWParam = w_param; + window_imp->mRawLParam = l_param; window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP"); LL_RECORD_BLOCK_TIME(FTM_KEYHANDLER); @@ -2177,6 +2184,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_CHAR: window_imp->mKeyCharCode = w_param; + window_imp->mRawMsg = u_msg; + window_imp->mRawWParam = w_param; + window_imp->mRawLParam = l_param; // Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need // to figure out how that works. - Doug @@ -3238,6 +3248,9 @@ LLSD LLWindowWin32::getNativeKeyData() result["scan_code"] = (S32)mKeyScanCode; result["virtual_key"] = (S32)mKeyVirtualKey; + result["msg"] = ll_sd_from_U32(mRawMsg); + result["w_param"] = ll_sd_from_U32(mRawWParam); + result["l_param"] = ll_sd_from_U32(mRawLParam); return result; } diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 2ca8d48fc7..376bef3e50 100755 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -208,6 +208,9 @@ protected: U32 mKeyCharCode; U32 mKeyScanCode; U32 mKeyVirtualKey; + U32 mRawMsg; + U32 mRawWParam; + U32 mRawLParam; friend class LLWindowManager; }; -- cgit v1.2.3 From 17ff449ae6b2759f212daa4fd3de0a7ea2664866 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 18 Sep 2015 15:07:27 -0700 Subject: Supress error after Xcode 7 update: error: null passed to a callee that requires a non-null argument --- indra/llwindow/llopenglview-objc.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 1c9160a42d..deb8cb90d8 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -239,7 +239,11 @@ attributedStringInfo getSegments(NSAttributedString *str) { [glContext setValues:(const GLint*)1 forParameter:NSOpenGLCPSwapInterval]; } else { - [glContext setValues:(const GLint*)0 forParameter:NSOpenGLCPSwapInterval]; + // supress this error after move to Xcode 7: + // error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull] + // Tried using ObjC 'nonnull' keyword as per SO article but didn't build + GLint swapInterval=0; + [glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; } mOldResize = false; -- cgit v1.2.3 From 9833a50260fb45d5f0033200ae756834c0cc9940 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Oct 2015 15:17:12 -0700 Subject: MAINT-5754: For MoaP and MediaCtrls forward all events including KEYUP and KEYDOWN to the CEF plugin. --- indra/llwindow/llkeyboardwin32.cpp | 4 ++-- indra/llwindow/llwindowwin32.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index dc40dcdde0..2123ed3939 100755 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -258,7 +258,7 @@ void LLKeyboardWin32::scanKeyboard() // *TODO: I KNOW there must be a better way of // interrogating the key state than this, using async key // state can cause ALL kinds of bugs - Doug - if (key < KEY_BUTTON0) + if ((key < KEY_BUTTON0) && ((key < '0') || (key > '9'))) { // ...under windows make sure the key actually still is down. // ...translate back to windows key @@ -267,7 +267,7 @@ void LLKeyboardWin32::scanKeyboard() if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000)) { //LL_INFOS() << "Key up event missed, resetting" << LL_ENDL; - mKeyLevel[key] = FALSE; + mKeyLevel[key] = FALSE; } } } diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 376bef3e50..1a775eadaf 100755 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -126,7 +126,7 @@ protected: HCURSOR loadColorCursor(LPCTSTR name); BOOL isValid(); void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); - LLSD getNativeKeyData(); + virtual LLSD getNativeKeyData(); // Changes display resolution. Returns true if successful BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); -- cgit v1.2.3 From bd817f6f422991c2653493436c7845e75ea9d855 Mon Sep 17 00:00:00 2001 From: rider Date: Fri, 6 Nov 2015 14:12:30 -0800 Subject: MAINT-5754: Basic keyboard functionality on the Mac. Still incomplete --- indra/llwindow/llopenglview-objc.mm | 45 ++++++++++++++++++++++++++++++++---- indra/llwindow/llwindowmacosx-objc.h | 23 ++++++++++++++++-- indra/llwindow/llwindowmacosx.cpp | 38 +++++++++++++++--------------- 3 files changed, 81 insertions(+), 25 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index deb8cb90d8..7bb20240d2 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -42,6 +42,7 @@ return screen; } + - (NSPoint)convertPointToScreenCoordinates:(NSPoint)aPoint { float normalizedX = fabs(fabs(self.frame.origin.x) - fabs(aPoint.x)); @@ -57,6 +58,24 @@ @end +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->mKeyModifiers = [theEvent modifierFlags]; + eventData->mScanCode = [theEvent keyCode ]; + eventData->mKeyboardType = 0; +} + + attributedStringInfo getSegments(NSAttributedString *str) { attributedStringInfo segments; @@ -402,11 +421,20 @@ attributedStringInfo getSegments(NSAttributedString *str) - (void) keyUp:(NSEvent *)theEvent { - callKeyUp([theEvent keyCode], [theEvent modifierFlags]); + NativeKeyEventData eventData; + + extractKeyDataFromEvent( theEvent, &eventData ); + eventData.mKeyEvent = NativeKeyEventData::KEYUP; + callKeyUp(&eventData, [theEvent keyCode], [theEvent modifierFlags]); } - (void) keyDown:(NSEvent *)theEvent { + NativeKeyEventData eventData; + + extractKeyDataFromEvent( theEvent, &eventData ); + eventData.mKeyEvent = NativeKeyEventData::KEYDOWN; + uint keycode = [theEvent keyCode]; // We must not depend on flagsChange event to detect modifier flags changed, // must depend on the modifire flags in the event parameter. @@ -414,7 +442,7 @@ attributedStringInfo getSegments(NSAttributedString *str) // e.g. OS Window for upload something or Input Window... // mModifiers instance variable is for insertText: or insertText:replacementRange: (by Pell Smit) mModifiers = [theEvent modifierFlags]; - bool acceptsText = mHasMarkedText ? false : callKeyDown(keycode, mModifiers); + bool acceptsText = mHasMarkedText ? false : callKeyDown(&eventData, keycode, mModifiers); unichar ch; if (acceptsText && !mMarkedTextAllowed && @@ -435,12 +463,17 @@ attributedStringInfo getSegments(NSAttributedString *str) // Since SL assumes we receive those, we fake it here. if (mModifiers & NSCommandKeyMask && !mHasMarkedText) { - callKeyUp([theEvent keyCode], mModifiers); + eventData.mKeyEvent = NativeKeyEventData::KEYUP; + callKeyUp(&eventData, [theEvent keyCode], mModifiers); } } - (void)flagsChanged:(NSEvent *)theEvent { + NativeKeyEventData eventData; + + extractKeyDataFromEvent( theEvent, &eventData ); + mModifiers = [theEvent modifierFlags]; callModifier([theEvent modifierFlags]); @@ -462,11 +495,13 @@ attributedStringInfo getSegments(NSAttributedString *str) if (mModifiers & mask) { - callKeyDown([theEvent keyCode], 0); + eventData.mKeyEvent = NativeKeyEventData::KEYDOWN; + callKeyDown(&eventData, [theEvent keyCode], 0); } else { - callKeyUp([theEvent keyCode], 0); + eventData.mKeyEvent = NativeKeyEventData::KEYUP; + callKeyUp(&eventData, [theEvent keyCode], 0); } } diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index e6e8f27f53..2455d6aeb9 100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -46,6 +46,25 @@ typedef void *CursorRef; typedef void *NSWindowRef; typedef void *GLViewRef; + +struct NativeKeyEventData { + enum EventType { + KEYUNKNOWN, + KEYUP, + KEYDOWN, + KEYCHAR + }; + + EventType mKeyEvent; + uint32_t mKeyCode; + uint32_t mScanCode; + uint32_t mKeyModifiers; + uint32_t mKeyboardType; + wchar_t mCharacter; +}; + +typedef const NativeKeyEventData * NSKeyEventRef; + // These are defined in llappviewermacosx.cpp. bool initViewer(); void handleQuit(); @@ -102,8 +121,8 @@ void setupInputWindow(NSWindowRef window, GLViewRef view); // These are all implemented in llwindowmacosx.cpp. // This is largely for easier interop between Obj-C and C++ (at least in the viewer's case due to the BOOL vs. BOOL conflict) -bool callKeyUp(unsigned short key, unsigned int mask); -bool callKeyDown(unsigned short key, unsigned int mask); +bool callKeyUp(NSKeyEventRef event, unsigned short key, unsigned int mask); +bool callKeyDown(NSKeyEventRef event, unsigned short key, unsigned int mask); void callResetKeys(); bool callUnicodeCallback(wchar_t character, unsigned int mask); void callRightMouseDown(float *pos, unsigned int mask); 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) -- cgit v1.2.3 From 5449ae73b337c026afa93e99a47b670c28c8eb80 Mon Sep 17 00:00:00 2001 From: rider Date: Sat, 7 Nov 2015 12:09:08 -0800 Subject: MAINT-5754: Finish key modifier experiment. Still not working. --- indra/llwindow/llopenglview-objc.mm | 24 +++++++++++++++++++++++- indra/llwindow/llwindowmacosx.cpp | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 7bb20240d2..81e90accb7 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -28,6 +28,18 @@ #include "llwindowmacosx-objc.h" #import "llappdelegate-objc.h" + + +//--------------------------- +// 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 + +//--------------------------- + @implementation NSScreen (PointConversion) + (NSScreen *)currentScreenForMouseLocation @@ -70,7 +82,17 @@ void extractKeyDataFromEvent (NSEvent *theEvent, NativeKeyEventData * eventData) } eventData->mKeyEvent = NativeKeyEventData::KEYUNKNOWN; eventData->mKeyCode = [theEvent keyCode]; - eventData->mKeyModifiers = [theEvent modifierFlags]; + + 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; } diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 2a104c1877..7bc5d263e4 100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1733,6 +1733,7 @@ LLSD LLWindowMacOSX::getNativeKeyData() 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) // cause llsd serialization to create XML that the llsd deserializer won't parse! -- cgit v1.2.3 From c2ad041c23b0097aec30acc7447a42f96d515d3b Mon Sep 17 00:00:00 2001 From: rider Date: Fri, 13 Nov 2015 16:22:34 -0800 Subject: Encode keyboard event for reconstruction in the plugin. --- indra/llwindow/llopenglview-objc.mm | 36 ++++++++------------------------- indra/llwindow/llwindowmacosx-objc.h | 11 +++++----- indra/llwindow/llwindowmacosx.cpp | 39 ++++++------------------------------ 3 files changed, 20 insertions(+), 66 deletions(-) (limited to 'indra/llwindow') 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; } diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 2455d6aeb9..dc184b91fb 100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -56,11 +56,12 @@ struct NativeKeyEventData { }; EventType mKeyEvent; - uint32_t mKeyCode; - uint32_t mScanCode; - uint32_t mKeyModifiers; - uint32_t mKeyboardType; - wchar_t mCharacter; + uint32_t mEventType; + uint32_t mEventModifiers; + uint32_t mEventKeyCode; + uint32_t mEventChars; + uint32_t mEventUnmodChars; + bool mEventRepeat; }; typedef const NativeKeyEventData * NSKeyEventRef; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 7bc5d263e4..952c6751db 100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1726,39 +1726,12 @@ LLSD LLWindowMacOSX::getNativeKeyData() #if 1 if(mRawKeyEvent) { - - 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) - // cause llsd serialization to create XML that the llsd deserializer won't parse! - std::string unicode; - S32 err = noErr; - EventParamType actualType = typeUTF8Text; - UInt32 actualSize = 0; - char *buffer = NULL; - - err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL); - if(err == noErr) - { - // allocate a buffer and get the actual data. - buffer = new char[actualSize]; - err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, actualSize, &actualSize, buffer); - if(err == noErr) - { - unicode.assign(buffer, actualSize); - } - delete[] buffer; - } - - result["unicode"] = unicode; -#endif - + result["event_type"] = LLSD::Integer(mRawKeyEvent->mEventType); + result["event_modifiers"] = LLSD::Integer(mRawKeyEvent->mEventModifiers); + result["event_keycode"] = LLSD::Integer(mRawKeyEvent->mEventKeyCode); + result["event_chars"] = (mRawKeyEvent->mEventChars) ? LLSD(LLSD::Integer(mRawKeyEvent->mEventChars)) : LLSD(); + result["event_umodchars"] = (mRawKeyEvent->mEventUnmodChars) ? LLSD(LLSD::Integer(mRawKeyEvent->mEventUnmodChars)) : LLSD(); + result["event_isrepeat"] = LLSD::Boolean(mRawKeyEvent->mEventRepeat); } #endif -- cgit v1.2.3 From eb484d5051c48e3bd35a2f06915eb75cf5c8c1fc Mon Sep 17 00:00:00 2001 From: rider Date: Thu, 3 Dec 2015 13:32:06 -0800 Subject: MAINT-5909: Enable unicode text input on mac and feed that directly into the viewer. Windows fixes still required. --- indra/llwindow/llwindowmacosx.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 952c6751db..0d41884462 100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -221,7 +221,23 @@ void callResetKeys() bool callUnicodeCallback(wchar_t character, unsigned int mask) { - return gWindowImplementation->getCallbacks()->handleUnicodeChar(character, mask); + NativeKeyEventData eventData; + + memset(&eventData, 0, sizeof(NativeKeyEventData)); + + eventData.mKeyEvent = NativeKeyEventData::KEYCHAR; + eventData.mEventType = 0; + eventData.mEventModifiers = mask; + eventData.mEventKeyCode = 0; + eventData.mEventChars = character; + eventData.mEventUnmodChars = character; + eventData.mEventRepeat = false; + + mRawKeyEvent = &eventData; + + bool result = gWindowImplementation->getCallbacks()->handleUnicodeChar(character, mask); + mRawKeyEvent = NULL; + return result; } void callFocus() -- cgit v1.2.3