diff options
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llappdelegate-objc.h | 6 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.h | 12 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 22 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.mm | 10 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 14 |
6 files changed, 56 insertions, 10 deletions
diff --git a/indra/llwindow/llappdelegate-objc.h b/indra/llwindow/llappdelegate-objc.h index 6a4794f3c3..e7f6ecd5fc 100644 --- a/indra/llwindow/llappdelegate-objc.h +++ b/indra/llwindow/llappdelegate-objc.h @@ -11,11 +11,15 @@ @interface LLAppDelegate : NSObject <NSApplicationDelegate> { LLNSWindow *window; + NSWindow *inputWindow; + LLNonInlineTextView *inputView; NSTimer *frameTimer; } @property (assign) IBOutlet LLNSWindow *window; +@property (assign) IBOutlet NSWindow *inputWindow; +@property (assign) IBOutlet LLNonInlineTextView *inputView; - (void) mainLoop; - +- (void) showInputWindow:(bool)show; @end diff --git a/indra/llwindow/llopenglview-objc.h b/indra/llwindow/llopenglview-objc.h index 5f972b1a98..6b21148bb6 100644 --- a/indra/llwindow/llopenglview-objc.h +++ b/indra/llwindow/llopenglview-objc.h @@ -12,9 +12,6 @@ #import <CoreFoundation/CFNumber.h> #include <string> -// Some nasty shovelling of LLOpenGLView from LLNativeBindings to prevent any C++ <-> Obj-C interop oddities. -// Redraw callback handling removed (for now) due to being unneeded in the patch that preceeds this addition. - @interface LLOpenGLView : NSOpenGLView <NSTextInputClient> { std::string mLastDraggedUrl; @@ -44,6 +41,15 @@ @end +@interface LLNonInlineTextView : NSTextView +{ + LLOpenGLView *glview; +} + +- (void) setGLView:(LLOpenGLView*)view; + +@end + @interface LLNSWindow : NSWindow - (NSPoint)convertToScreenFromLocalPoint:(NSPoint)point relativeToView:(NSView *)view; diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 376d238c90..a6ef35a8eb 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -501,9 +501,25 @@ attributedStringInfo getSegments(NSAttributedString *str) @end -// We use a custom NSWindow for our event handling. -// Why not an NSWindowController you may ask? -// Answer: this is easier. +@implementation LLNonInlineTextView + +- (void) setGLView:(LLOpenGLView *)view +{ + glview = view; +} + +- (void) insertText:(id)insertString +{ + [self insertText:insertString replacementRange:NSMakeRange(0, 0)]; +} + +- (void) insertText:(id)aString replacementRange:(NSRange)replacementRange +{ + [glview insertText:aString replacementRange:replacementRange]; + [_window orderOut:_window]; +} + +@end @implementation LLNSWindow diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 1d05db14b2..14a0c22d66 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -90,6 +90,8 @@ void setWindowPos(NSWindowRef window, float* pos); void closeWindow(NSWindowRef window); void removeGLView(GLViewRef view); void makeFirstResponder(NSWindowRef window, GLViewRef view); +void setupInputWindow(NSWindowRef window, GLViewRef view); +void showInputWindow(bool show); // 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 43f853bfd1..0eef8c9f83 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -362,6 +362,16 @@ void removeGLView(GLViewRef view) [(LLOpenGLView*)view release]; } +void setupInputWindow(NSWindowRef window, GLViewRef glview) +{ + [[(LLAppDelegate*)[NSApp delegate] inputView] setGLView:(LLOpenGLView*)glview]; +} + +void showInputWindow(bool show) +{ + [(LLAppDelegate*)[NSApp delegate] showInputWindow:show]; +} + NSWindowRef getMainAppWindow() { LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window]; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 6f66da66a4..2d0f981b3e 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -191,6 +191,8 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, //start with arrow cursor initCursors(); setCursor( UI_CURSOR_ARROW ); + + allowLanguageTextInput(NULL, FALSE); } mCallbacks = callbacks; @@ -513,18 +515,22 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits // Get the view instead. mGLView = createOpenGLView(mWindow, mFSAASamples, !disable_vsync); mContext = getCGLContextObj(mGLView); + // Since we just created the context, it needs to be set up. glNeedsInit = TRUE; gGLManager.mVRAM = getVramSize(mGLView); } - + + // This sets up our view to recieve text from our non-inline text input window. + setupInputWindow(mWindow, mGLView); + // Hook up the context to a drawable if(mContext != NULL) { - LL_INFOS("Window") << "Setting CGL Context..." << LL_ENDL; - LL_DEBUGS("Window") << "createContext: setting current context" << LL_ENDL; + + U32 err = CGLSetCurrentContext(mContext); if (err != kCGLNoError) { @@ -1888,6 +1894,8 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) return; } + showInputWindow(!b); + // Take care of old and new preeditors. if (preeditor != mPreeditor || !b) { |