Support the committing of the current pre edit string when language input is interrupted per the viewer's original pre edit functionality.

master
Geenz 2013-04-07 11:33:39 -04:00
parent 5098d43a9b
commit aa0cb35db5
5 changed files with 21 additions and 1 deletions

View File

@ -19,11 +19,14 @@
float mMousePos[2]; float mMousePos[2];
bool mHasMarkedText; bool mHasMarkedText;
unsigned int mMarkedTextLength; unsigned int mMarkedTextLength;
NSAttributedString *mMarkedText;
} }
- (id) initWithSamples:(NSUInteger)samples; - (id) initWithSamples:(NSUInteger)samples;
- (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync; - (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync;
- (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync; - (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync;
- (void)commitCurrentPreedit;
// rebuildContext // rebuildContext
// Destroys and recreates a context with the view's internal format set via setPixelFormat; // 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. // Use this in event of needing to rebuild a context for whatever reason, without needing to assign a new pixel format.

View File

@ -420,11 +420,20 @@ attributedStringInfo getSegments(NSAttributedString *str)
setMarkedText(text, selected, replacement, [aString length], segments); setMarkedText(text, selected, replacement, [aString length], segments);
mHasMarkedText = TRUE; mHasMarkedText = TRUE;
mMarkedTextLength = [aString length]; mMarkedTextLength = [aString length];
mMarkedText = (NSAttributedString*)[aString mutableString];
} }
} }
- (void)commitCurrentPreedit
{
[self insertText:mMarkedText replacementRange:NSMakeRange(0, [mMarkedText length])];
[[self inputContext] discardMarkedText];
}
- (void)unmarkText - (void)unmarkText
{ {
[[self inputContext] discardMarkedText];
[mMarkedText setValue:@""];
resetPreedit(); resetPreedit();
mHasMarkedText = FALSE; mHasMarkedText = FALSE;
} }
@ -517,6 +526,8 @@ attributedStringInfo getSegments(NSAttributedString *str)
{ {
[glview insertText:aString replacementRange:replacementRange]; [glview insertText:aString replacementRange:replacementRange];
[_window orderOut:_window]; [_window orderOut:_window];
[[self textStorage] setValue:@""];
[[self inputContext] discardMarkedText];
} }
@end @end

View File

@ -117,6 +117,7 @@ void callFocus();
void callFocusLost(); void callFocusLost();
void callModifier(unsigned int mask); void callModifier(unsigned int mask);
void callQuitHandler(); void callQuitHandler();
void commitCurrentPreedit(GLViewRef glView);
#include <string> #include <string>
void callHandleDragEntered(std::string url); void callHandleDragEntered(std::string url);

View File

@ -372,6 +372,11 @@ void showInputWindow(bool show)
[(LLAppDelegate*)[NSApp delegate] showInputWindow:show]; [(LLAppDelegate*)[NSApp delegate] showInputWindow:show];
} }
void commitCurrentPreedit(GLViewRef glView)
{
[(LLOpenGLView*)glView commitCurrentPreedit];
}
NSWindowRef getMainAppWindow() NSWindowRef getMainAppWindow()
{ {
LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window]; LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window];

View File

@ -1864,7 +1864,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
void LLWindowMacOSX::interruptLanguageTextInput() void LLWindowMacOSX::interruptLanguageTextInput()
{ {
// TODO: IME support commitCurrentPreedit(mGLView);
} }
//static //static