diff options
Diffstat (limited to 'linden/indra/llwindow/llwindowmacosx.cpp')
-rw-r--r-- | linden/indra/llwindow/llwindowmacosx.cpp | 75 |
1 files changed, 74 insertions, 1 deletions
diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp index 0c5d6ed..021d7a4 100644 --- a/linden/indra/llwindow/llwindowmacosx.cpp +++ b/linden/indra/llwindow/llwindowmacosx.cpp | |||
@@ -239,6 +239,10 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width, | |||
239 | mNeedsResize = FALSE; | 239 | mNeedsResize = FALSE; |
240 | mOverrideAspectRatio = 0.f; | 240 | mOverrideAspectRatio = 0.f; |
241 | mMinimized = FALSE; | 241 | mMinimized = FALSE; |
242 | mTSMDocument = NULL; // Just in case. | ||
243 | mLanguageTextInputAllowed = FALSE; | ||
244 | mTSMScriptCode = 0; | ||
245 | mTSMLangCode = 0; | ||
242 | 246 | ||
243 | // For reasons that aren't clear to me, LLTimers seem to be created in the "started" state. | 247 | // For reasons that aren't clear to me, LLTimers seem to be created in the "started" state. |
244 | // Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state. | 248 | // Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state. |
@@ -479,6 +483,29 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
479 | 483 | ||
480 | } | 484 | } |
481 | 485 | ||
486 | { | ||
487 | // Create and initialize our TSM document for language text input. | ||
488 | // If an error occured, we can do nothing better than simply ignore it. | ||
489 | // mTSMDocument will be kept NULL in case. | ||
490 | if (mTSMDocument) | ||
491 | { | ||
492 | DeactivateTSMDocument(mTSMDocument); | ||
493 | DeleteTSMDocument(mTSMDocument); | ||
494 | mTSMDocument = NULL; | ||
495 | } | ||
496 | static InterfaceTypeList types = { kUnicodeDocument }; | ||
497 | OSErr err = NewTSMDocument(1, types, &mTSMDocument, 0); | ||
498 | if (err != noErr) | ||
499 | { | ||
500 | llwarns << "createContext: couldn't create a TSMDocument (" << err << ")" << llendl; | ||
501 | } | ||
502 | if (mTSMDocument) | ||
503 | { | ||
504 | UseInputWindow(mTSMDocument, TRUE); | ||
505 | ActivateTSMDocument(mTSMDocument); | ||
506 | } | ||
507 | } | ||
508 | |||
482 | if(mContext == NULL) | 509 | if(mContext == NULL) |
483 | { | 510 | { |
484 | AGLRendererInfo rendererInfo = NULL; | 511 | AGLRendererInfo rendererInfo = NULL; |
@@ -924,6 +951,15 @@ void LLWindowMacOSX::destroyContext() | |||
924 | mWindowHandlerRef = NULL; | 951 | mWindowHandlerRef = NULL; |
925 | } | 952 | } |
926 | 953 | ||
954 | // Cleanup any TSM document we created. | ||
955 | if(mTSMDocument != NULL) | ||
956 | { | ||
957 | llinfos << "destroyContext: deleting TSM document" << llendl; | ||
958 | DeactivateTSMDocument(mTSMDocument); | ||
959 | DeleteTSMDocument(mTSMDocument); | ||
960 | mTSMDocument = NULL; | ||
961 | } | ||
962 | |||
927 | // Close the window | 963 | // Close the window |
928 | if(mWindow != NULL) | 964 | if(mWindow != NULL) |
929 | { | 965 | { |
@@ -1529,7 +1565,7 @@ void LLWindowMacOSX::flashIcon(F32 seconds) | |||
1529 | OSErr err; | 1565 | OSErr err; |
1530 | 1566 | ||
1531 | mBounceTime = seconds; | 1567 | mBounceTime = seconds; |
1532 | memset(&mBounceRec, sizeof(mBounceRec), 0); | 1568 | memset(&mBounceRec, 0, sizeof(mBounceRec)); |
1533 | mBounceRec.qType = nmType; | 1569 | mBounceRec.qType = nmType; |
1534 | mBounceRec.nmMark = 1; | 1570 | mBounceRec.nmMark = 1; |
1535 | err = NMInstall(&mBounceRec); | 1571 | err = NMInstall(&mBounceRec); |
@@ -2241,6 +2277,10 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e | |||
2241 | switch(evtKind) | 2277 | switch(evtKind) |
2242 | { | 2278 | { |
2243 | case kEventWindowActivated: | 2279 | case kEventWindowActivated: |
2280 | if (mTSMDocument) | ||
2281 | { | ||
2282 | ActivateTSMDocument(mTSMDocument); | ||
2283 | } | ||
2244 | mCallbacks->handleFocus(this); | 2284 | mCallbacks->handleFocus(this); |
2245 | break; | 2285 | break; |
2246 | case kEventWindowDeactivated: | 2286 | case kEventWindowDeactivated: |
@@ -2952,4 +2992,37 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key) | |||
2952 | return int_value; // otherwise return the long value | 2992 | return int_value; // otherwise return the long value |
2953 | } | 2993 | } |
2954 | 2994 | ||
2995 | void LLWindowMacOSX::allowLanguageTextInput(BOOL b) | ||
2996 | { | ||
2997 | ScriptLanguageRecord script_language; | ||
2998 | |||
2999 | if (b == mLanguageTextInputAllowed) | ||
3000 | { | ||
3001 | return; | ||
3002 | } | ||
3003 | mLanguageTextInputAllowed = b; | ||
3004 | |||
3005 | if (b) | ||
3006 | { | ||
3007 | if (mTSMScriptCode != smRoman) | ||
3008 | { | ||
3009 | script_language.fScript = mTSMScriptCode; | ||
3010 | script_language.fLanguage = mTSMLangCode; | ||
3011 | SetTextServiceLanguage(&script_language); | ||
3012 | } | ||
3013 | } | ||
3014 | else | ||
3015 | { | ||
3016 | GetTextServiceLanguage(&script_language); | ||
3017 | mTSMScriptCode = script_language.fScript; | ||
3018 | mTSMLangCode = script_language.fLanguage; | ||
3019 | if (mTSMScriptCode != smRoman) | ||
3020 | { | ||
3021 | script_language.fScript = smRoman; | ||
3022 | script_language.fLanguage = langEnglish; | ||
3023 | SetTextServiceLanguage(&script_language); | ||
3024 | } | ||
3025 | } | ||
3026 | } | ||
3027 | |||
2955 | #endif // LL_DARWIN | 3028 | #endif // LL_DARWIN |