diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llwindow/llappdelegate-objc.h | 4 | ||||
-rw-r--r-- | indra/newview/SecondLife.nib | bin | 12997 -> 13009 bytes | |||
-rw-r--r-- | indra/newview/SecondLife.xib | 25 | ||||
-rw-r--r-- | indra/newview/llappdelegate-objc.mm | 45 |
4 files changed, 57 insertions, 17 deletions
diff --git a/indra/llwindow/llappdelegate-objc.h b/indra/llwindow/llappdelegate-objc.h index e7f6ecd5fc..be9ad4d79f 100644 --- a/indra/llwindow/llappdelegate-objc.h +++ b/indra/llwindow/llappdelegate-objc.h @@ -14,12 +14,16 @@ NSWindow *inputWindow; LLNonInlineTextView *inputView; NSTimer *frameTimer; + NSString *currentInputLanguage; } @property (assign) IBOutlet LLNSWindow *window; @property (assign) IBOutlet NSWindow *inputWindow; @property (assign) IBOutlet LLNonInlineTextView *inputView; +@property (retain) NSString *currentInputLanguage; + - (void) mainLoop; - (void) showInputWindow:(bool)show; +- (void) languageUpdated; @end diff --git a/indra/newview/SecondLife.nib b/indra/newview/SecondLife.nib Binary files differindex 0b0ff5308b..cb289ebf09 100644 --- a/indra/newview/SecondLife.nib +++ b/indra/newview/SecondLife.nib diff --git a/indra/newview/SecondLife.xib b/indra/newview/SecondLife.xib index fdfea49c42..c6b72485a1 100644 --- a/indra/newview/SecondLife.xib +++ b/indra/newview/SecondLife.xib @@ -2,9 +2,9 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00"> <data> <int key="IBDocument.SystemTarget">1060</int> - <string key="IBDocument.SystemVersion">12D78</string> + <string key="IBDocument.SystemVersion">12E30</string> <string key="IBDocument.InterfaceBuilderVersion">3084</string> - <string key="IBDocument.AppKitVersion">1187.37</string> + <string key="IBDocument.AppKitVersion">1187.39</string> <string key="IBDocument.HIToolboxVersion">626.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -329,16 +329,13 @@ <nil key="NSViewClass"/> <nil key="NSUserInterfaceItemIdentifier"/> <object class="NSView" key="NSWindowView" id="305280978"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <array class="NSMutableArray" key="NSSubviews"/> <string key="NSFrameSize">{1024, 600}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> <string key="NSReuseIdentifierKey">_NS:20</string> </object> - <string key="NSScreenRect">{{0, 0}, {2560, 1440}}</string> + <string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string> <string key="NSMaxSize">{10000000000000, 10000000000000}</string> <string key="NSFrameAutosaveName">Second Life</string> <int key="NSWindowCollectionBehavior">128</int> @@ -349,7 +346,7 @@ <int key="NSWindowBacking">2</int> <string key="NSWindowRect">{{272, 176}, {938, 42}}</string> <int key="NSWTFlags">-1535638528</int> - <string key="NSWindowTitle">Window</string> + <string key="NSWindowTitle">Input Window</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> <nil key="NSUserInterfaceItemIdentifier"/> @@ -536,7 +533,7 @@ <reference key="NSNextKeyView" ref="238626476"/> <string key="NSReuseIdentifierKey">_NS:21</string> </object> - <string key="NSScreenRect">{{0, 0}, {2560, 1440}}</string> + <string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string> <string key="NSMaxSize">{10000000000000, 10000000000000}</string> <bool key="NSWindowIsRestorable">YES</bool> </object> @@ -1112,7 +1109,7 @@ <string key="841.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="92.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="941.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <boolean value="YES" key="941.NSWindowTemplate.visibleAtLaunch"/> + <boolean value="NO" key="941.NSWindowTemplate.visibleAtLaunch"/> <array class="NSMutableArray" key="942.IBNSViewMetadataConstraints"> <reference ref="609370450"/> <reference ref="262904360"/> @@ -1182,6 +1179,14 @@ <string key="minorKey">./Classes/LLNonInlineTextView.h</string> </object> </object> + <object class="IBPartialClassDescription"> + <string key="className">NSLayoutConstraint</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/NSLayoutConstraint.h</string> + </object> + </object> </array> </object> <int key="IBDocument.localizationMode">0</int> diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index 8da44fcf33..de77447006 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -8,12 +8,14 @@ #import "llappdelegate-objc.h" #include "llwindowmacosx-objc.h" +#include <Carbon/Carbon.h> // Used for Text Input Services ("Safe" API - it's well supported) @implementation LLAppDelegate @synthesize window; @synthesize inputWindow; @synthesize inputView; +@synthesize currentInputLanguage; - (void)dealloc { @@ -24,12 +26,16 @@ { frameTimer = nil; + [self languageUpdated]; + if (initViewer()) { frameTimer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(mainLoop) userInfo:nil repeats:YES]; } else { handleQuit(); } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(languageUpdated) name:@"NSTextInputContextKeyboardSelectionDidChangeNotification" object:nil]; } - (void) applicationDidBecomeActive:(NSNotification *)notification @@ -67,15 +73,40 @@ - (void) showInputWindow:(bool)show { - if (show) + // How to add support for new languages with the input window: + // Simply append this array with the language code (ja for japanese, ko for korean, zh for chinese, etc.) + NSArray *authorizedLanguages = [[NSArray alloc] initWithObjects:@"ja", @"ko", @"zh-Hant", @"zh-Hans", nil]; + + if ([authorizedLanguages containsObject:currentInputLanguage]) { - NSLog(@"Showing input window."); - [inputWindow makeKeyAndOrderFront:inputWindow]; - } else { - NSLog(@"Hiding input window."); - [inputWindow orderOut:inputWindow]; - [window makeKeyAndOrderFront:window]; + if (show) + { + NSLog(@"Showing input window."); + [inputWindow makeKeyAndOrderFront:inputWindow]; + } else { + NSLog(@"Hiding input window."); + [inputWindow orderOut:inputWindow]; + [window makeKeyAndOrderFront:window]; + } } } +// This will get called multiple times by NSNotificationCenter. +// It will be called every time that the window focus changes, and every time that the input language gets changed. +// The primary use case for this selector is to update our current input language when the user, for whatever reason, changes the input language. +// This is the more elegant way of handling input language changes instead of checking every time we want to use the input window. + +- (void) languageUpdated +{ + TISInputSourceRef currentInput = TISCopyCurrentKeyboardInputSource(); + CFArrayRef languages = (CFArrayRef)TISGetInputSourceProperty(currentInput, kTISPropertyInputSourceLanguages); + +#if 1 // In the event of ever needing to add new language sources, change this to 1 and watch the terminal for "languages:" + NSLog(@"languages: %@", TISGetInputSourceProperty(currentInput, kTISPropertyInputSourceLanguages)); +#endif + + // Typically the language we want is going to be the very first result in the array. + currentInputLanguage = (NSString*)CFArrayGetValueAtIndex(languages, 0); +} + @end |