summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorGeenz <geenz@geenzo.com>2013-04-07 11:33:39 -0400
committerGeenz <geenz@geenzo.com>2013-04-07 11:33:39 -0400
commitaa0cb35db561004c205c7aac2570407ae88ad472 (patch)
treef91a5860aa0b445d303e3fa3d08a4124eacb0cd8 /indra/llwindow
parent5098d43a9be5b9638a8806918e9bb82a096c000f (diff)
Support the committing of the current pre edit string when language input is interrupted per the viewer's original pre edit functionality.
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llopenglview-objc.h3
-rw-r--r--indra/llwindow/llopenglview-objc.mm11
-rw-r--r--indra/llwindow/llwindowmacosx-objc.h1
-rw-r--r--indra/llwindow/llwindowmacosx-objc.mm5
-rw-r--r--indra/llwindow/llwindowmacosx.cpp2
5 files changed, 21 insertions, 1 deletions
diff --git a/indra/llwindow/llopenglview-objc.h b/indra/llwindow/llopenglview-objc.h
index 6b21148bb6..6d0f138950 100644
--- a/indra/llwindow/llopenglview-objc.h
+++ b/indra/llwindow/llopenglview-objc.h
@@ -19,11 +19,14 @@
float mMousePos[2];
bool mHasMarkedText;
unsigned int mMarkedTextLength;
+ NSAttributedString *mMarkedText;
}
- (id) initWithSamples:(NSUInteger)samples;
- (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync;
- (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync;
+- (void)commitCurrentPreedit;
+
// rebuildContext
// Destroys and recreates a context with the view's internal format set via setPixelFormat;
// Use this in event of needing to rebuild a context for whatever reason, without needing to assign a new pixel format.
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index a6ef35a8eb..9d55b2c551 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -420,11 +420,20 @@ attributedStringInfo getSegments(NSAttributedString *str)
setMarkedText(text, selected, replacement, [aString length], segments);
mHasMarkedText = TRUE;
mMarkedTextLength = [aString length];
+ mMarkedText = (NSAttributedString*)[aString mutableString];
}
}
+- (void)commitCurrentPreedit
+{
+ [self insertText:mMarkedText replacementRange:NSMakeRange(0, [mMarkedText length])];
+ [[self inputContext] discardMarkedText];
+}
+
- (void)unmarkText
{
+ [[self inputContext] discardMarkedText];
+ [mMarkedText setValue:@""];
resetPreedit();
mHasMarkedText = FALSE;
}
@@ -517,6 +526,8 @@ attributedStringInfo getSegments(NSAttributedString *str)
{
[glview insertText:aString replacementRange:replacementRange];
[_window orderOut:_window];
+ [[self textStorage] setValue:@""];
+ [[self inputContext] discardMarkedText];
}
@end
diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h
index 14a0c22d66..59d956d4c8 100644
--- a/indra/llwindow/llwindowmacosx-objc.h
+++ b/indra/llwindow/llwindowmacosx-objc.h
@@ -117,6 +117,7 @@ void callFocus();
void callFocusLost();
void callModifier(unsigned int mask);
void callQuitHandler();
+void commitCurrentPreedit(GLViewRef glView);
#include <string>
void callHandleDragEntered(std::string url);
diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm
index 0eef8c9f83..4bd65ade82 100644
--- a/indra/llwindow/llwindowmacosx-objc.mm
+++ b/indra/llwindow/llwindowmacosx-objc.mm
@@ -372,6 +372,11 @@ void showInputWindow(bool show)
[(LLAppDelegate*)[NSApp delegate] showInputWindow:show];
}
+void commitCurrentPreedit(GLViewRef glView)
+{
+ [(LLOpenGLView*)glView commitCurrentPreedit];
+}
+
NSWindowRef getMainAppWindow()
{
LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window];
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 4f6ae5c799..e1220c83f4 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1864,7 +1864,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
void LLWindowMacOSX::interruptLanguageTextInput()
{
- // TODO: IME support
+ commitCurrentPreedit(mGLView);
}
//static