diff options
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 10 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.h | 1 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.mm | 5 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 24 |
4 files changed, 33 insertions, 7 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 45a5f24481..ca00185dff 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -345,16 +345,21 @@ - (NSRange)markedRange { - return NSMakeRange(NSNotFound, 0); + int range[2]; + getPreeditMarkedRange(&range[0], &range[1]); + return NSMakeRange(range[0], range[1]); } - (NSRange)selectedRange { - return NSMakeRange(NSNotFound, 0); + int range[2]; + getPreeditSelectionRange(&range[0], &range[1]); + return NSMakeRange(range[0], range[1]); } - (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { + } - (void)unmarkText @@ -425,7 +430,6 @@ - (id) init { - [self makeFirstResponder:[self contentView]]; return self; } diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index f3d6d2b1f1..57bb071690 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -74,6 +74,7 @@ void convertScreenToView(NSWindowRef window, float *coord); void setWindowPos(NSWindowRef window, float* pos); void closeWindow(NSWindowRef window); void removeGLView(GLViewRef view); +void makeFirstResponder(NSWindowRef window, GLViewRef view); // 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 b859f236d4..9530785b83 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -337,6 +337,11 @@ NSWindowRef getMainAppWindow() return winRef; } +void makeFirstResponder(NSWindowRef window, GLViewRef view) +{ + [(LLNSWindow*)window makeFirstResponder:(LLOpenGLView*)view]; +} + /* GLViewRef getGLView() { diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 08612bace4..7e4b9a84a1 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -383,22 +383,37 @@ void callQuitHandler() std::basic_string<wchar_t> getPreeditString() { - return gWindowImplementation->getPreeditor()->getPreeditString(); + std::basic_string<wchar_t> str; + if (gWindowImplementation->getPreeditor()) + { + str = gWindowImplementation->getPreeditor()->getPreeditString(); + } + + return str; } void getPreeditSelectionRange(int *position, int *length) { - gWindowImplementation->getPreeditor()->getSelectionRange(position, length); + if (gWindowImplementation->getPreeditor()) + { + gWindowImplementation->getPreeditor()->getSelectionRange(position, length); + } } void getPreeditMarkedRange(int *position, int *length) { - gWindowImplementation->getPreeditor()->getPreeditRange(position, length); + if (gWindowImplementation->getPreeditor()) + { + gWindowImplementation->getPreeditor()->getPreeditRange(position, length); + } } void handleUnicodeCharacter(wchar_t c) { - gWindowImplementation->getPreeditor()->handleUnicodeCharHere(c); + if (gWindowImplementation->getPreeditor()) + { + gWindowImplementation->getPreeditor()->handleUnicodeCharHere(c); + } } void LLWindowMacOSX::updateMouseDeltas(float* deltas) @@ -498,6 +513,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits } } LL_INFOS("Window") << "Completed context creation." << LL_ENDL; + makeFirstResponder(mWindow, mGLView); // Don't need to get the current gamma, since there's a call that restores it to the system defaults. return TRUE; } |