Have showInputWindow hand off input events to the bottom line input window.

master
Geenz 2013-06-17 10:28:32 -04:00
parent 440a1ee3ba
commit 2253d22eb8
5 changed files with 13 additions and 11 deletions

View File

@ -24,6 +24,6 @@
@property (retain) NSString *currentInputLanguage;
- (void) mainLoop;
- (void) showInputWindow:(bool)show withText:(id)text;
- (void) showInputWindow:(bool)show withEvent:(NSEvent*)textEvent;
- (void) languageUpdated;
@end

View File

@ -321,11 +321,16 @@ attributedStringInfo getSegments(NSAttributedString *str)
{
if (!mMarkedTextAllowed && [[theEvent characters] characterAtIndex:0] != NSBackspaceCharacter)
{
showInputWindow(true, @"");
[[[(LLAppDelegate*)[NSApp delegate] inputView] inputContext] handleEvent:theEvent];
[(LLAppDelegate*)[NSApp delegate] showInputWindow:true withEvent:theEvent];
}
[[self inputContext] handleEvent:theEvent];
} else if ([[theEvent charactersIgnoringModifiers] characterAtIndex:0] == 13 || [[theEvent charactersIgnoringModifiers] characterAtIndex:0] == 3)
{
// callKeyDown won't return the value we expect for enter or return. Handle them as a separate case.
[[self inputContext] handleEvent:theEvent];
}
// OS X intentionally does not send us key-up information on cmd-key combinations.
// This behaviour is not a bug, and only applies to cmd-combinations (no others).
// Since SL assumes we receive those, we fake it here.

View File

@ -91,7 +91,6 @@ 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* 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)

View File

@ -367,11 +367,6 @@ void setupInputWindow(NSWindowRef window, GLViewRef glview)
[[(LLAppDelegate*)[NSApp delegate] inputView] setGLView:(LLOpenGLView*)glview];
}
void showInputWindow(bool show, void* text)
{
[(LLAppDelegate*)[NSApp delegate] showInputWindow:show withText:(id)text];
}
void commitCurrentPreedit(GLViewRef glView)
{
[(LLOpenGLView*)glView commitCurrentPreedit];

View File

@ -71,7 +71,7 @@
}
}
- (void) showInputWindow:(bool)show withText:(id)text
- (void) showInputWindow:(bool)show withEvent:(NSEvent*)textEvent
{
// 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,7 +83,10 @@
{
NSLog(@"Showing input window.");
[inputWindow makeKeyAndOrderFront:inputWindow];
[inputView setMarkedText:text selectedRange:NSMakeRange(0, 1)];
if (textEvent != nil)
{
[[inputView inputContext] handleEvent:textEvent];
}
} else {
NSLog(@"Hiding input window.");
[inputWindow orderOut:inputWindow];