diff options
-rw-r--r-- | indra/llwindow/llappdelegate-objc.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 9 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.h | 1 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx-objc.mm | 5 | ||||
-rw-r--r-- | indra/newview/llappdelegate-objc.mm | 7 |
5 files changed, 13 insertions, 11 deletions
diff --git a/indra/llwindow/llappdelegate-objc.h b/indra/llwindow/llappdelegate-objc.h index b1d78d5e3c..266f417c4b 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 withText:(id)text; +- (void) showInputWindow:(bool)show withEvent:(NSEvent*)textEvent; - (void) languageUpdated; @end diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 99c27e79a0..2afd4993c5 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -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. diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index daf7596cab..5b1f22046b 100755 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -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) diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 7f1af129b4..33a8cf34ce 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -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]; diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index 403c307085..cec9c586e6 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -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]; |