More LLPreeditor work.

master
Geenz 2013-03-19 23:02:47 -04:00
parent ebe320e7c3
commit 64c0455db5
4 changed files with 33 additions and 7 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -337,6 +337,11 @@ NSWindowRef getMainAppWindow()
return winRef;
}
void makeFirstResponder(NSWindowRef window, GLViewRef view)
{
[(LLNSWindow*)window makeFirstResponder:(LLOpenGLView*)view];
}
/*
GLViewRef getGLView()
{

View File

@ -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;
}