diff options
-rw-r--r-- | indra/llwindow/llappdelegate-objc.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 13 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.h | 2 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.mm | 4 | ||||
-rw-r--r-- | indra/newview/llappdelegate-objc.mm | 3 |
5 files changed, 15 insertions, 9 deletions
diff --git a/indra/llwindow/llappdelegate-objc.h b/indra/llwindow/llappdelegate-objc.h index be9ad4d79f..b1d78d5e3c 100644 --- a/indra/llwindow/llappdelegate-objc.h +++ b/indra/llwindow/llappdelegate-objc.h @@ -24,6 +24,6 @@ @property (retain) NSString *currentInputLanguage; - (void) mainLoop; -- (void) showInputWindow:(bool)show; +- (void) showInputWindow:(bool)show withText:(id)text; - (void) languageUpdated; @end diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index b431321da6..062577baf8 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -404,10 +404,11 @@ attributedStringInfo getSegments(NSAttributedString *str) - (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { - if (mMarkedTextAllowed) + if ([aString class] == NSClassFromString(@"NSConcreteMutableAttributedString")) { - if ([aString class] == NSClassFromString(@"NSConcreteMutableAttributedString")) + if (mMarkedTextAllowed) { + unsigned int selected[2] = { selectedRange.location, selectedRange.length @@ -425,9 +426,13 @@ attributedStringInfo getSegments(NSAttributedString *str) mHasMarkedText = TRUE; mMarkedTextLength = [aString length]; mMarkedText = (NSAttributedString*)[aString mutableString]; + } else if ([[aString mutableString] characterAtIndex:0] != NSBackspaceCharacter) { + showInputWindow(true, aString); + if (mHasMarkedText) + { + [self unmarkText]; + } } - } else { - showInputWindow(true); } } diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 62543fa01d..daf7596cab 100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -91,7 +91,7 @@ void closeWindow(NSWindowRef window); void removeGLView(GLViewRef view); void makeFirstResponder(NSWindowRef window, GLViewRef view); void setupInputWindow(NSWindowRef window, GLViewRef view); -void showInputWindow(bool show); +void showInputWindow(bool show, void* text); // 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) diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 95b9cdb863..7f1af129b4 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -367,9 +367,9 @@ void setupInputWindow(NSWindowRef window, GLViewRef glview) [[(LLAppDelegate*)[NSApp delegate] inputView] setGLView:(LLOpenGLView*)glview]; } -void showInputWindow(bool show) +void showInputWindow(bool show, void* text) { - [(LLAppDelegate*)[NSApp delegate] showInputWindow:show]; + [(LLAppDelegate*)[NSApp delegate] showInputWindow:show withText:(id)text]; } void commitCurrentPreedit(GLViewRef glView) diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index de77447006..b4f9c56b00 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -71,7 +71,7 @@ } } -- (void) showInputWindow:(bool)show +- (void) showInputWindow:(bool)show withText:(id)text { // 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.) @@ -83,6 +83,7 @@ { NSLog(@"Showing input window."); [inputWindow makeKeyAndOrderFront:inputWindow]; + [inputView setMarkedText:text selectedRange:NSMakeRange(0, 1)]; } else { NSLog(@"Hiding input window."); [inputWindow orderOut:inputWindow]; |