Support the committing of the current pre edit string when language input is interrupted per the viewer's original pre edit functionality.
parent
5098d43a9b
commit
aa0cb35db5
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -1864,7 +1864,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
|
|||
|
||||
void LLWindowMacOSX::interruptLanguageTextInput()
|
||||
{
|
||||
// TODO: IME support
|
||||
commitCurrentPreedit(mGLView);
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
|
|||
Loading…
Reference in New Issue