summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGeenz <geenz@geenzo.com>2013-06-17 08:59:01 -0400
committerGeenz <geenz@geenzo.com>2013-06-17 08:59:01 -0400
commit93531f3ba85748ba5c9f1d797c4925f55fe8b92c (patch)
tree7691427ffccb5a711e7c580062976bbeeadbba95 /indra
parentf8abfb63c32a0926a393a4359c6f387482d2448e (diff)
Insert text into the input window when we attempt to insert text without a pre-editor. Also handle backspace as a special case when determining if the input window needs to be displayed.
Diffstat (limited to 'indra')
-rw-r--r--indra/llwindow/llappdelegate-objc.h2
-rw-r--r--indra/llwindow/llopenglview-objc.mm13
-rwxr-xr-xindra/llwindow/llwindowmacosx-objc.h2
-rwxr-xr-xindra/llwindow/llwindowmacosx-objc.mm4
-rw-r--r--indra/newview/llappdelegate-objc.mm3
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];