From c8aa1fb7c8ed44886599ea4e04eed403392e2e34 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 17 Dec 2012 18:00:30 -0500 Subject: LLWindow: Move to using Cocoa for window and view creation along with setting up callbacks for event handling as such. --- indra/llwindow/llwindowmacosx-objc.mm | 221 +++++++++++++++++++++++++++++++++- 1 file changed, 219 insertions(+), 2 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index bebb537cd8..03c0f55883 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -26,6 +26,9 @@ */ #include +#include +#include "llwindowmacosx-objc.h" +#include "llopenglview-objc.h" /* * These functions are broken out into a separate file because the @@ -34,8 +37,6 @@ * linden headers with any objective-C++ source. */ -#include "llwindowmacosx-objc.h" - void setupCocoa() { static bool inited = false; @@ -83,6 +84,51 @@ CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY) return (CursorRef)cursor; } +void setArrowCursor() +{ + NSCursor *cursor = [NSCursor arrowCursor]; + [cursor set]; +} + +void setIBeamCursor() +{ + NSCursor *cursor = [NSCursor IBeamCursor]; + [cursor set]; +} + +void setPointingHandCursor() +{ + NSCursor *cursor = [NSCursor pointingHandCursor]; + [cursor set]; +} + +void setCopyCursor() +{ + NSCursor *cursor = [NSCursor dragCopyCursor]; + [cursor set]; +} + +void setCrossCursor() +{ + NSCursor *cursor = [NSCursor crosshairCursor]; + [cursor set]; +} + +void hideNSCursor() +{ + [NSCursor hide]; +} + +void showNSCursor() +{ + [NSCursor unhide]; +} + +void hideNSCursorTillMove(bool hide) +{ + [NSCursor setHiddenUntilMouseMoves:hide]; +} + // This is currently unused, since we want all our cursors to persist for the life of the app, but I've included it for completeness. OSErr releaseImageCursor(CursorRef ref) { @@ -118,3 +164,174 @@ OSErr setImageCursor(CursorRef ref) return noErr; } +// Now for some unholy juggling between generic pointers and casting them to Obj-C objects! +// Note: things can get a bit hairy from here. This is not for the faint of heart. + +NSWindowRef createNSWindow(int x, int y, int width, int height) +{ + LLNSWindow *window = [[LLNSWindow alloc]initWithContentRect:NSMakeRect(x, y, width, height) + styleMask:NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:NO]; + [window makeKeyAndOrderFront:nil]; + [window setAcceptsMouseMovedEvents:TRUE]; + return window; +} + +GLViewRef createOpenGLView(NSWindowRef window) +{ + LLOpenGLView *glview = [[LLOpenGLView alloc]initWithFrame:[(LLNSWindow*)window frame] withSamples:0 andVsync:FALSE]; + [(LLNSWindow*)window setContentView:glview]; + return glview; +} + +void glSwapBuffers(void* context) +{ + [(NSOpenGLContext*)context flushBuffer]; +} + +CGLContextObj getCGLContextObj(NSWindowRef window) +{ + LLOpenGLView *glview = [(LLNSWindow*)window contentView]; + return [glview getCGLContextObj]; +} + +CGLPixelFormatObj* getCGLPixelFormatObj(NSWindowRef window) +{ + LLOpenGLView *glview = [(LLNSWindow*)window contentView]; + return [glview getCGLPixelFormatObj]; +} + +void getContentViewBounds(NSWindowRef window, float* bounds) +{ + bounds[0] = [[(LLNSWindow*)window contentView] bounds].origin.x; + bounds[1] = [[(LLNSWindow*)window contentView] bounds].origin.y; + bounds[2] = [[(LLNSWindow*)window contentView] bounds].size.width; + bounds[3] = [[(LLNSWindow*)window contentView] bounds].size.height; +} + +void getWindowSize(NSWindowRef window, float* size) +{ + NSRect frame = [(LLNSWindow*)window frame]; + size[0] = frame.origin.x; + size[1] = frame.origin.y; + size[2] = frame.size.width; + size[3] = frame.size.height; +} + +void setWindowSize(NSWindowRef window, int width, int height) +{ + NSRect frame = [(LLNSWindow*)window frame]; + frame.size.width = width; + frame.size.height = height; + [(LLNSWindow*)window setFrame:frame display:TRUE]; +} + +void setWindowPos(NSWindowRef window, float* pos) +{ + NSPoint point; + point.x = pos[0]; + point.y = pos[1]; + [(LLNSWindow*)window setFrameOrigin:point]; +} + +void getCursorPos(NSWindowRef window, float* pos) +{ + NSPoint mLoc; + mLoc = [(LLNSWindow*)window mouseLocationOutsideOfEventStream]; + pos[0] = mLoc.x; + pos[1] = mLoc.y; +} + +void makeWindowOrderFront(NSWindowRef window) +{ + [(LLNSWindow*)window makeKeyAndOrderFront:nil]; +} + +void convertScreenToWindow(NSWindowRef window, float *coord) +{ + NSPoint point; + point.x = coord[0]; + point.y = coord[1]; + point = [(LLNSWindow*)window convertScreenToBase:point]; + coord[0] = point.x; + coord[1] = point.y; +} + +void convertWindowToScreen(NSWindowRef window, float *coord) +{ + NSPoint point; + point.x = coord[0]; + point.y = coord[1]; + point = [(LLNSWindow*)window convertBaseToScreen:point]; + coord[0] = point.x; + coord[1] = point.y; +} + +void registerKeyUpCallback(NSWindowRef window, std::tr1::function callback) +{ + [(LLNSWindow*)window registerKeyUpCallback:callback]; +} + +void registerKeyDownCallback(NSWindowRef window, std::tr1::function callback) +{ + [(LLNSWindow*)window registerKeyDownCallback:callback]; +} + +void registerUnicodeCallback(NSWindowRef window, std::tr1::function callback) +{ + [(LLNSWindow*)window registerUnicodeCallback:callback]; +} + +void registerMouseUpCallback(NSWindowRef window, MouseCallback callback) +{ + [(LLNSWindow*)window registerMouseUpCallback:callback]; +} + +void registerMouseDownCallback(NSWindowRef window, MouseCallback callback) +{ + [(LLNSWindow*)window registerMouseDownCallback:callback]; +} + +void registerRightMouseUpCallback(NSWindowRef window, MouseCallback callback) +{ + [(LLNSWindow*)window registerRightMouseUpCallback:callback]; +} + +void registerRightMouseDownCallback(NSWindowRef window, MouseCallback callback) +{ + [(LLNSWindow*)window registerRightMouseDownCallback:callback]; +} + +void registerDoubleClickCallback(NSWindowRef window, MouseCallback callback) +{ + [(LLNSWindow*)window registerDoubleClickCallback:callback]; +} + +void registerResizeEventCallback(GLViewRef glview, ResizeCallback callback) +{ + [(LLOpenGLView*)glview registerResizeCallback:callback]; +} + +void registerMouseMovedCallback(NSWindowRef window, MouseCallback callback) +{ + [(LLNSWindow*)window registerMouseMovedCallback:callback]; +} + +void registerScrollCallback(NSWindowRef window, ScrollWheelCallback callback) +{ + [(LLNSWindow*)window registerScrollCallback:callback]; +} + +void registerMouseExitCallback(NSWindowRef window, VoidCallback callback) +{ + [(LLNSWindow*)window registerMouseExitCallback:callback]; +} + +void registerDeltaUpdateCallback(NSWindowRef window, MouseCallback callback) +{ + [(LLNSWindow*)window registerDeltaUpdateCallback:callback]; +} + +unsigned int getModifiers() +{ + return [NSEvent modifierFlags]; +} -- cgit v1.2.3 From bd152c1fb75c4a8d4b9271896c44243ca8759e58 Mon Sep 17 00:00:00 2001 From: Geenz Date: Sat, 29 Dec 2012 06:59:43 -0500 Subject: Huge amount of refactoring to use Cocoa here: - Updated to .xib format. To produce a new nib (which is required after changing the xib file), use "ibtool SecondLife.xib --compile SecondLife.nib" within the newview directory. - xib file now defines the viewer's window. VIews are still being pragmatically added to the main window. This may change in the future. - LLAppViewer's main loop has been slightly refactored to be executed on a timer for OS X. This probably needs a bit more work. - Event handling still needs more work to work within a timer based event loop. It works fairly sporadically at the moment, as if events are being dropped between timer executions, at least for the mouse. - Carbon has been purged from the viewer's startup, and from LLWindow entirely. There's likely still a few odds and ends fragmented throughout the viewer and its dependencies. Need to track these down. - LLAppViewerMacOSX now uses NSApplicationMain, and also implements the NSApplicationDelegate protocol in LLAppDelegate. - Fullscreen support has been implemented for OS X 10.7+ This is still a work in progress, however at this stage everything needed for a functional viewer is (mostly) complete. From here, it's mostly just bug hunting and fixing. --- indra/llwindow/llwindowmacosx-objc.mm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 03c0f55883..07efc25ea6 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -54,10 +54,10 @@ void setupCocoa() // http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html // Needed for Carbon based applications which call into Cocoa - NSApplicationLoad(); + // NSApplicationLoad(); // Must first call [[[NSWindow alloc] init] release] to get the NSWindow machinery set up so that NSCursor can use a window to cache the cursor image - [[[NSWindow alloc] init] release]; + //[[[NSWindow alloc] init] release]; [pool release]; @@ -188,10 +188,9 @@ void glSwapBuffers(void* context) [(NSOpenGLContext*)context flushBuffer]; } -CGLContextObj getCGLContextObj(NSWindowRef window) +CGLContextObj getCGLContextObj(GLViewRef view) { - LLOpenGLView *glview = [(LLNSWindow*)window contentView]; - return [glview getCGLContextObj]; + return [(LLOpenGLView *)view getCGLContextObj]; } CGLPixelFormatObj* getCGLPixelFormatObj(NSWindowRef window) @@ -331,6 +330,16 @@ void registerDeltaUpdateCallback(NSWindowRef window, MouseCallback callback) [(LLNSWindow*)window registerDeltaUpdateCallback:callback]; } +NSWindowRef getMainAppWindow() +{ + return winRef; +} + +GLViewRef getGLView(NSWindowRef window) +{ + return glviewRef; +} + unsigned int getModifiers() { return [NSEvent modifierFlags]; -- cgit v1.2.3 From ddb48d51d996b18063b111faa3b7e709160074d9 Mon Sep 17 00:00:00 2001 From: Geenz Date: Tue, 1 Jan 2013 11:32:53 -0500 Subject: More things in this commit: - Removed the callback system in favor of simply defining functions in a header to later be implemented in whichever file is most convenient for what we want to do (i.e., calling LLWindow callbacks within LLWindowMacOSX, setting cursors in llwindowmacosx-objc.mm, etc.) - Viewer shutdown now works appropriately - Added a bit of debugging code to test if a key has been handled by the UI or not (useful for tracking down the mystery of the enter key not being handled) - Setup a cocoa quit handler within the application delegate that intercepts any termination requests --- indra/llwindow/llwindowmacosx-objc.mm | 74 +++++++---------------------------- 1 file changed, 15 insertions(+), 59 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 07efc25ea6..f3972303f1 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -255,6 +255,15 @@ void convertScreenToWindow(NSWindowRef window, float *coord) coord[1] = point.y; } +void convertScreenToView(NSWindowRef window, float *coord) +{ + NSRect point; + point.origin.x = coord[0]; + point.origin.y = coord[1]; + point.origin = [(LLNSWindow*)window convertScreenToBase:point.origin]; + point.origin = [[(LLNSWindow*)window contentView] convertPoint:point.origin fromView:nil]; +} + void convertWindowToScreen(NSWindowRef window, float *coord) { NSPoint point; @@ -265,73 +274,20 @@ void convertWindowToScreen(NSWindowRef window, float *coord) coord[1] = point.y; } -void registerKeyUpCallback(NSWindowRef window, std::tr1::function callback) -{ - [(LLNSWindow*)window registerKeyUpCallback:callback]; -} - -void registerKeyDownCallback(NSWindowRef window, std::tr1::function callback) -{ - [(LLNSWindow*)window registerKeyDownCallback:callback]; -} - -void registerUnicodeCallback(NSWindowRef window, std::tr1::function callback) -{ - [(LLNSWindow*)window registerUnicodeCallback:callback]; -} - -void registerMouseUpCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerMouseUpCallback:callback]; -} - -void registerMouseDownCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerMouseDownCallback:callback]; -} - -void registerRightMouseUpCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerRightMouseUpCallback:callback]; -} - -void registerRightMouseDownCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerRightMouseDownCallback:callback]; -} - -void registerDoubleClickCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerDoubleClickCallback:callback]; -} - -void registerResizeEventCallback(GLViewRef glview, ResizeCallback callback) -{ - [(LLOpenGLView*)glview registerResizeCallback:callback]; -} - -void registerMouseMovedCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerMouseMovedCallback:callback]; -} - -void registerScrollCallback(NSWindowRef window, ScrollWheelCallback callback) -{ - [(LLNSWindow*)window registerScrollCallback:callback]; -} - -void registerMouseExitCallback(NSWindowRef window, VoidCallback callback) +void closeWindow(NSWindowRef window) { - [(LLNSWindow*)window registerMouseExitCallback:callback]; + [(LLNSWindow*)window close]; } -void registerDeltaUpdateCallback(NSWindowRef window, MouseCallback callback) +void removeGLView(GLViewRef view) { - [(LLNSWindow*)window registerDeltaUpdateCallback:callback]; + [(LLOpenGLView*)view removeFromSuperview]; + [(LLOpenGLView*)view release]; } NSWindowRef getMainAppWindow() { + [(LLNSWindow*)winRef setAcceptsMouseMovedEvents:TRUE]; return winRef; } -- cgit v1.2.3 From 9ce3ab1a5248423eeea4d843bfb8407ed62b305e Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 2 Jan 2013 18:53:44 -0500 Subject: Fixed the enter and return keys not being sent appropriately as unicode characters. --- indra/llwindow/llwindowmacosx-objc.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index f3972303f1..5a024eda46 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -291,7 +291,7 @@ NSWindowRef getMainAppWindow() return winRef; } -GLViewRef getGLView(NSWindowRef window) +GLViewRef getGLView() { return glviewRef; } -- cgit v1.2.3 From 09b07e3619a71f142c1a3af41244d756e1230142 Mon Sep 17 00:00:00 2001 From: Geenz Date: Tue, 8 Jan 2013 16:22:54 -0500 Subject: Big change set: - LLAppDelegate header relocated to LLWindow. Definition is still present in secondlife-bin (for compatibility reasons when loading a nib). - Return key handling fixed. - Command key now acts the same as the control key by issuing control character codes when the command key is pressed. - We now retrieve the window pointer directly from the app delegate in LLWindow. --- indra/llwindow/llwindowmacosx-objc.mm | 56 +++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 15 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 5a024eda46..1a64c94b2d 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -29,6 +29,7 @@ #include #include "llwindowmacosx-objc.h" #include "llopenglview-objc.h" +#include "llappdelegate-objc.h" /* * These functions are broken out into a separate file because the @@ -37,6 +38,11 @@ * linden headers with any objective-C++ source. */ +int createNSApp(int argc, const char *argv[]) +{ + return NSApplicationMain(argc, argv); +} + void setupCocoa() { static bool inited = false; @@ -49,15 +55,6 @@ void setupCocoa() // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' // when init'ing the Cocoa App window. [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; - - // This is a bit of voodoo taken from the Apple sample code "CarbonCocoa_PictureCursor": - // http://developer.apple.com/samplecode/CarbonCocoa_PictureCursor/index.html - - // Needed for Carbon based applications which call into Cocoa - // NSApplicationLoad(); - - // Must first call [[[NSWindow alloc] init] release] to get the NSWindow machinery set up so that NSCursor can use a window to cache the cursor image - //[[[NSWindow alloc] init] release]; [pool release]; @@ -65,6 +62,38 @@ void setupCocoa() } } +bool copyToPBoard(const unsigned short *str, unsigned int len) +{ + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + [pboard clearContents]; + + NSArray *contentsToPaste = [[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil]; + + return [pboard writeObjects:contentsToPaste]; +} + +bool pasteBoardAvailable() +{ + NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; + return [[NSPasteboard generalPasteboard] canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; +} + +const unsigned short *copyFromPBoard() +{ + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; + NSString *str = NULL; + BOOL ok = [pboard canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; + if (ok) + { + NSArray *objToPaste = [pboard readObjectsForClasses:classArray options:[NSDictionary dictionary]]; + str = [objToPaste objectAtIndex:0]; + } + unichar* temp = (unichar*)calloc([str length], sizeof(unichar)); + [str getCharacters:temp]; + return temp; +} + CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @@ -287,15 +316,12 @@ void removeGLView(GLViewRef view) NSWindowRef getMainAppWindow() { - [(LLNSWindow*)winRef setAcceptsMouseMovedEvents:TRUE]; + LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window]; + + [winRef setAcceptsMouseMovedEvents:TRUE]; return winRef; } -GLViewRef getGLView() -{ - return glviewRef; -} - unsigned int getModifiers() { return [NSEvent modifierFlags]; -- cgit v1.2.3 From 29e747c4f17818816c502a3aa653b828e689be4a Mon Sep 17 00:00:00 2001 From: Geenz Date: Tue, 22 Jan 2013 15:37:01 -0500 Subject: And thus, the demonic mouse position conversions from view space to screen space were tamed. --- indra/llwindow/llwindowmacosx-objc.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 1a64c94b2d..b6e5767203 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -298,7 +298,7 @@ void convertWindowToScreen(NSWindowRef window, float *coord) NSPoint point; point.x = coord[0]; point.y = coord[1]; - point = [(LLNSWindow*)window convertBaseToScreen:point]; + point = [(LLNSWindow*)window convertToScreenFromLocalPoint:point relativeToView:[(LLNSWindow*)window contentView]]; coord[0] = point.x; coord[1] = point.y; } -- cgit v1.2.3 From 461ab912a58b67579fffdf70ec7e38d682927185 Mon Sep 17 00:00:00 2001 From: Geenz Date: Tue, 22 Jan 2013 19:59:49 -0500 Subject: Initial Cocoa drag and drop support. --- indra/llwindow/llwindowmacosx-objc.mm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index b6e5767203..7867226476 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -143,6 +143,12 @@ void setCrossCursor() [cursor set]; } +void setNotAllowedCursor() +{ + NSCursor *cursor = [NSCursor operationNotAllowedCursor]; + [cursor set]; +} + void hideNSCursor() { [NSCursor hide]; -- cgit v1.2.3 From c52e6f9c597c67637045134d808a9039f85efc5c Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 23 Jan 2013 09:29:32 -0500 Subject: Refactor the key input handling to make it easier to filter out keys we don't need unicode characters for (such as the arrow keys). --- indra/llwindow/llwindowmacosx-objc.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 7867226476..b123ba0711 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -64,11 +64,12 @@ void setupCocoa() bool copyToPBoard(const unsigned short *str, unsigned int len) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; NSPasteboard *pboard = [NSPasteboard generalPasteboard]; [pboard clearContents]; NSArray *contentsToPaste = [[NSArray alloc] initWithObjects:[NSString stringWithCharacters:str length:len], nil]; - + [pool release]; return [pboard writeObjects:contentsToPaste]; } @@ -80,6 +81,7 @@ bool pasteBoardAvailable() const unsigned short *copyFromPBoard() { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; NSPasteboard *pboard = [NSPasteboard generalPasteboard]; NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; NSString *str = NULL; @@ -91,6 +93,7 @@ const unsigned short *copyFromPBoard() } unichar* temp = (unichar*)calloc([str length], sizeof(unichar)); [str getCharacters:temp]; + [pool release]; return temp; } @@ -312,6 +315,7 @@ void convertWindowToScreen(NSWindowRef window, float *coord) void closeWindow(NSWindowRef window) { [(LLNSWindow*)window close]; + [(LLNSWindow*)window release]; } void removeGLView(GLViewRef view) -- cgit v1.2.3 From e19db5668853b7d3be2ed6af289a3c35bd213bca Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 25 Feb 2013 15:35:21 -0500 Subject: Fix for antialiasing and VSync not being enabled properly. --- indra/llwindow/llwindowmacosx-objc.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index b123ba0711..b288671219 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -214,9 +214,9 @@ NSWindowRef createNSWindow(int x, int y, int width, int height) return window; } -GLViewRef createOpenGLView(NSWindowRef window) +GLViewRef createOpenGLView(NSWindowRef window, unsigned int samples, bool vsync) { - LLOpenGLView *glview = [[LLOpenGLView alloc]initWithFrame:[(LLNSWindow*)window frame] withSamples:0 andVsync:FALSE]; + LLOpenGLView *glview = [[LLOpenGLView alloc]initWithFrame:[(LLNSWindow*)window frame] withSamples:samples andVsync:vsync]; [(LLNSWindow*)window setContentView:glview]; return glview; } -- cgit v1.2.3 From f5516e0fc0e6c22b25f9dca2b9b24ebd7618332a Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 27 Feb 2013 06:46:53 -0800 Subject: For MAINT-2404 Fixes detection of VRAM on OSX removed along with other AGL code. Code Review: callum --- indra/llwindow/llwindowmacosx-objc.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index b288671219..9b57cd27cd 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -237,6 +237,11 @@ CGLPixelFormatObj* getCGLPixelFormatObj(NSWindowRef window) return [glview getCGLPixelFormatObj]; } +unsigned long getVramSize(GLViewRef view) +{ + return [(LLOpenGLView *)view getVramSize]; +} + void getContentViewBounds(NSWindowRef window, float* bounds) { bounds[0] = [[(LLNSWindow*)window contentView] bounds].origin.x; -- cgit v1.2.3 From 5caa7a465e73fc9cf70f5f2c5d147a509bd5e185 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 11 Mar 2013 10:16:22 -0400 Subject: Bug fixing and prep-work for IME support (along with refactored text input in general). --- indra/llwindow/llwindowmacosx-objc.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index b288671219..e4e12f4b5c 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -332,7 +332,14 @@ NSWindowRef getMainAppWindow() return winRef; } -unsigned int getModifiers() +/* +GLViewRef getGLView() { + return [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] glview]; +} +*/ + +unsigned int getModifiers() +{ return [NSEvent modifierFlags]; } -- cgit v1.2.3 From 64c0455db568e6818c483785cff0fcd9cfa47aff Mon Sep 17 00:00:00 2001 From: Geenz Date: Tue, 19 Mar 2013 23:02:47 -0400 Subject: More LLPreeditor work. --- indra/llwindow/llwindowmacosx-objc.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') 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() { -- cgit v1.2.3 From 258b77b64777a5ce5fef0ef066aa52b34b43ba65 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 25 Mar 2013 05:26:55 -0400 Subject: Additional IME support. LLPreeditor is largely good to go at this point, but there's still some work to do in getSegments. --- indra/llwindow/llwindowmacosx-objc.mm | 45 ++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 9530785b83..1a0647485c 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -119,6 +119,7 @@ CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY) void setArrowCursor() { NSCursor *cursor = [NSCursor arrowCursor]; + [NSCursor unhide]; [cursor set]; } @@ -290,12 +291,44 @@ void makeWindowOrderFront(NSWindowRef window) void convertScreenToWindow(NSWindowRef window, float *coord) { - NSPoint point; - point.x = coord[0]; - point.y = coord[1]; - point = [(LLNSWindow*)window convertScreenToBase:point]; - coord[0] = point.x; - coord[1] = point.y; + NSRect point; + point.origin.x = coord[0]; + point.origin.y = coord[1]; + point = [(LLNSWindow*)window convertRectFromScreen:point]; + coord[0] = point.origin.x; + coord[1] = point.origin.y; +} + +void convertRectToScreen(NSWindowRef window, float *coord) +{ + NSRect point; + point.origin.x = coord[0]; + point.origin.y = coord[1]; + point.size.width = coord[2]; + point.size.height = coord[3]; + + point = [(LLNSWindow*)window convertRectToScreen:point]; + + coord[0] = point.origin.x; + coord[1] = point.origin.y; + coord[2] = point.size.width; + coord[3] = point.size.height; +} + +void convertRectFromScreen(NSWindowRef window, float *coord) +{ + NSRect point; + point.origin.x = coord[0]; + point.origin.y = coord[1]; + point.size.width = coord[2]; + point.size.height = coord[3]; + + point = [(LLNSWindow*)window convertRectFromScreen:point]; + + coord[0] = point.origin.x; + coord[1] = point.origin.y; + coord[2] = point.size.width; + coord[3] = point.size.height; } void convertScreenToView(NSWindowRef window, float *coord) -- cgit v1.2.3 From 80a79e5d7b4f37f862b312e848b1d1e7f85b0fa9 Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 27 Mar 2013 08:49:45 -0400 Subject: IME support is pretty much finished at this point. --- indra/llwindow/llwindowmacosx-objc.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 1a0647485c..43f853bfd1 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -27,8 +27,8 @@ #include #include -#include "llwindowmacosx-objc.h" #include "llopenglview-objc.h" +#include "llwindowmacosx-objc.h" #include "llappdelegate-objc.h" /* -- cgit v1.2.3 From 2656b1f405dcf3b67d644bf47b02a64886ef2ca4 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 1 Apr 2013 08:15:12 -0400 Subject: First pass at adding a viable replacement for TSM's old UseInputWindow method (which is now deprecated with seemingly no Cocoa replacement). --- indra/llwindow/llwindowmacosx-objc.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') 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]; -- cgit v1.2.3 From aa0cb35db561004c205c7aac2570407ae88ad472 Mon Sep 17 00:00:00 2001 From: Geenz Date: Sun, 7 Apr 2013 11:33:39 -0400 Subject: Support the committing of the current pre edit string when language input is interrupted per the viewer's original pre edit functionality. --- indra/llwindow/llwindowmacosx-objc.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 0eef8c9f83..4bd65ade82 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -372,6 +372,11 @@ void showInputWindow(bool show) [(LLAppDelegate*)[NSApp delegate] showInputWindow:show]; } +void commitCurrentPreedit(GLViewRef glView) +{ + [(LLOpenGLView*)glView commitCurrentPreedit]; +} + NSWindowRef getMainAppWindow() { LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window]; -- cgit v1.2.3 From cda10266ae91e28f2ac60b8472d6b8592f877d65 Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 23 May 2013 08:50:05 -0400 Subject: Only show the input window when we attempt to add marked text, *and* we can't submit marked text directly to the viewer. --- indra/llwindow/llwindowmacosx-objc.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 4bd65ade82..95b9cdb863 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -377,6 +377,11 @@ void commitCurrentPreedit(GLViewRef glView) [(LLOpenGLView*)glView commitCurrentPreedit]; } +void allowDirectMarkedTextInput(bool allow) +{ + +} + NSWindowRef getMainAppWindow() { LLNSWindow *winRef = [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] window]; -- cgit v1.2.3 From 93531f3ba85748ba5c9f1d797c4925f55fe8b92c Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 17 Jun 2013 08:59:01 -0400 Subject: Insert text into the input window when we attempt to insert text without a pre-editor. Also handle backspace as a special case when determining if the input window needs to be displayed. --- indra/llwindow/llwindowmacosx-objc.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 95b9cdb863..7f1af129b4 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -367,9 +367,9 @@ void setupInputWindow(NSWindowRef window, GLViewRef glview) [[(LLAppDelegate*)[NSApp delegate] inputView] setGLView:(LLOpenGLView*)glview]; } -void showInputWindow(bool show) +void showInputWindow(bool show, void* text) { - [(LLAppDelegate*)[NSApp delegate] showInputWindow:show]; + [(LLAppDelegate*)[NSApp delegate] showInputWindow:show withText:(id)text]; } void commitCurrentPreedit(GLViewRef glView) -- cgit v1.2.3 From 2253d22eb85a6b4c5e48b9905d807d0ac48b1930 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 17 Jun 2013 10:28:32 -0400 Subject: Have showInputWindow hand off input events to the bottom line input window. --- indra/llwindow/llwindowmacosx-objc.mm | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') 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]; -- cgit v1.2.3 From 2837ca7a474f92bb363a2a31d184431b636d2809 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 17 Jun 2013 17:08:48 -0400 Subject: This seems to be on par with viewer-release at this point. --- indra/llwindow/llwindowmacosx-objc.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 33a8cf34ce..67b5279c0b 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -372,9 +372,9 @@ void commitCurrentPreedit(GLViewRef glView) [(LLOpenGLView*)glView commitCurrentPreedit]; } -void allowDirectMarkedTextInput(bool allow) +void allowDirectMarkedTextInput(bool allow, GLViewRef glView) { - + [(LLOpenGLView*)glView allowMarkedTextInput:allow]; } NSWindowRef getMainAppWindow() -- cgit v1.2.3 From 623077e6a4eef516d445975eaa71d5f67e6767c5 Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 27 Jun 2013 15:06:03 -0400 Subject: Added license headers. --- indra/llwindow/llwindowmacosx-objc.mm | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 67b5279c0b..41d8e3ecd9 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -1,4 +1,4 @@ -/** +/** * @file llwindowmacosx-objc.mm * @brief Definition of functions shared between llwindowmacosx.cpp * and llwindowmacosx-objc.mm. @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -52,10 +52,10 @@ void setupCocoa() NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // The following prevents the Cocoa command line parser from trying to open 'unknown' arguements as documents. - // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' - // when init'ing the Cocoa App window. + // ie. running './secondlife -set Language fr' would cause a pop-up saying can't open document 'fr' + // when init'ing the Cocoa App window. [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; - + [pool release]; inited = true; @@ -100,17 +100,17 @@ const unsigned short *copyFromPBoard() CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + // extra retain on the NSCursor since we want it to live for the lifetime of the app. NSCursor *cursor = - [[[NSCursor alloc] - initWithImage: - [[[NSImage alloc] initWithContentsOfFile: - [NSString stringWithFormat:@"%s", fullpath] - ]autorelease] - hotSpot:NSMakePoint(hotspotX, hotspotY) - ]retain]; - + [[[NSCursor alloc] + initWithImage: + [[[NSImage alloc] initWithContentsOfFile: + [NSString stringWithFormat:@"%s", fullpath] + ]autorelease] + hotSpot:NSMakePoint(hotspotX, hotspotY) + ]retain]; + [pool release]; return (CursorRef)cursor; @@ -209,7 +209,7 @@ OSErr setImageCursor(CursorRef ref) NSWindowRef createNSWindow(int x, int y, int width, int height) { LLNSWindow *window = [[LLNSWindow alloc]initWithContentRect:NSMakeRect(x, y, width, height) - styleMask:NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:NO]; + styleMask:NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:NO]; [window makeKeyAndOrderFront:nil]; [window setAcceptsMouseMovedEvents:TRUE]; return window; @@ -391,13 +391,13 @@ void makeFirstResponder(NSWindowRef window, GLViewRef view) } /* -GLViewRef getGLView() -{ - return [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] glview]; -} -*/ + GLViewRef getGLView() + { + return [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] glview]; + } + */ unsigned int getModifiers() -{ +{ return [NSEvent modifierFlags]; } -- cgit v1.2.3 From b2bec3f99c74d21bb1c2c68d73854f3990db26d5 Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 11 Jul 2013 19:37:08 -0400 Subject: STORM-1942: dock icon bouncing unimplemented --- indra/llwindow/llwindowmacosx-objc.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 41d8e3ecd9..ef29515403 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -390,6 +390,11 @@ void makeFirstResponder(NSWindowRef window, GLViewRef view) [(LLNSWindow*)window makeFirstResponder:(LLOpenGLView*)view]; } +void requestUserAttention() +{ + [[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest]; +} + /* GLViewRef getGLView() { -- cgit v1.2.3 From a787e272c31d8e535dae75e4d95365d17cec78db Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 11 Jul 2013 21:31:17 -0400 Subject: Alert box support! --- indra/llwindow/llwindowmacosx-objc.mm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index ef29515403..3703dcf28d 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -395,6 +395,41 @@ void requestUserAttention() [[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest]; } +long showAlert(std::string text, std::string title, int type) +{ + NSAlert *alert = [[NSAlert alloc] init]; + + [alert setMessageText:[NSString stringWithCString:title.c_str() encoding:[NSString defaultCStringEncoding]]]; + [alert setInformativeText:[NSString stringWithCString:text.c_str() encoding:[NSString defaultCStringEncoding]]]; + if (type == 0) + { + [alert addButtonWithTitle:@"Okay"]; + } else if (type == 1) + { + [alert addButtonWithTitle:@"Okay"]; + [alert addButtonWithTitle:@"Cancel"]; + } else if (type == 2) + { + [alert addButtonWithTitle:@"Yes"]; + [alert addButtonWithTitle:@"No"]; + } + long ret = [alert runModal]; + [alert dealloc]; + + if (ret == NSAlertFirstButtonReturn) + { + ret = 0; + } else if (ret == NSAlertSecondButtonReturn) + { + ret = 1; + } else if (ret == NSAlertThirdButtonReturn) + { + ret = 2; + } + + return ret; +} + /* GLViewRef getGLView() { -- cgit v1.2.3 From 2f680eec93f1b06620c04af04116fe49d577cf8f Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 11 Jul 2013 21:46:10 -0400 Subject: A bit of cleanup and make the return of showAlert match the OSBTN return types in llwindow.h. --- indra/llwindow/llwindowmacosx-objc.mm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'indra/llwindow/llwindowmacosx-objc.mm') diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 3703dcf28d..0354c2b717 100755 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -418,13 +418,22 @@ long showAlert(std::string text, std::string title, int type) if (ret == NSAlertFirstButtonReturn) { - ret = 0; + if (type == 1) + { + ret = 3; + } else if (type == 2) + { + ret = 0; + } } else if (ret == NSAlertSecondButtonReturn) { - ret = 1; - } else if (ret == NSAlertThirdButtonReturn) - { - ret = 2; + if (type == 0 || type == 1) + { + ret = 2; + } else if (type == 2) + { + ret = 1; + } } return ret; -- cgit v1.2.3