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/newview/CMakeLists.txt | 8 ++-- indra/newview/llappdelegate-objc.mm | 55 ++++++++++++++++++++++++++++ indra/newview/llappviewermacosx-delegate.h | 22 ----------- indra/newview/llappviewermacosx-delegate.mm | 57 ----------------------------- indra/newview/llappviewermacosx-objc.h | 19 ---------- indra/newview/llappviewermacosx-objc.mm | 20 ---------- indra/newview/llappviewermacosx.cpp | 2 +- 7 files changed, 60 insertions(+), 123 deletions(-) create mode 100644 indra/newview/llappdelegate-objc.mm delete mode 100644 indra/newview/llappviewermacosx-delegate.h delete mode 100644 indra/newview/llappviewermacosx-delegate.mm delete mode 100644 indra/newview/llappviewermacosx-objc.h delete mode 100644 indra/newview/llappviewermacosx-objc.mm (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 73f5ecc38c..c60940f93c 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1231,10 +1231,9 @@ source_group("CMake Rules" FILES ViewerInstall.cmake) if (DARWIN) LIST(APPEND viewer_SOURCE_FILES llappviewermacosx.cpp) - LIST(APPEND viewer_SOURCE_FILES llappviewermacosx-objc.h) - LIST(APPEND viewer_SOURCE_FILES llappviewermacosx-objc.mm) - LIST(APPEND viewer_SOURCE_FILES llappviewermacosx-delegate.h) - LIST(APPEND viewer_SOURCE_FILES llappviewermacosx-delegate.mm) + + # This should be compiled with the viewer. + LIST(APPEND viewer_SOURCE_FILES llappdelegate-objc.mm) find_library(AGL_LIBRARY AGL) find_library(APPKIT_LIBRARY AppKit) @@ -1532,6 +1531,7 @@ if (FMOD) if (DARWIN) set(fmodwrapper_SOURCE_FILES fmodwrapper.cpp) add_library(fmodwrapper SHARED ${fmodwrapper_SOURCE_FILES}) + find_library(CARBON_LIBRARY Carbon) set(fmodwrapper_needed_LIBRARIES ${FMOD_LIBRARY} ${CARBON_LIBRARY}) set_target_properties( fmodwrapper diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm new file mode 100644 index 0000000000..f5143d7578 --- /dev/null +++ b/indra/newview/llappdelegate-objc.mm @@ -0,0 +1,55 @@ +// +// LLAppDelegate.m +// SecondLife +// +// Created by Geenz on 12/16/12. +// +// + +#import "llappdelegate-objc.h" + +@implementation LLAppDelegate + +@synthesize window; + +- (void)dealloc +{ + [super dealloc]; +} + +- (void) applicationDidFinishLaunching:(NSNotification *)notification +{ + frameTimer = nil; + + if (initViewer()) + { + frameTimer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(mainLoop) userInfo:nil repeats:YES]; + } else { + handleQuit(); + } +} + +- (NSApplicationDelegateReply) applicationShouldTerminate:(NSApplication *)sender +{ + if (!runMainLoop()) + { + handleQuit(); + return NSTerminateCancel; + } else { + [frameTimer release]; + cleanupViewer(); + return NSTerminateNow; + } +} + +- (void) mainLoop +{ + bool appExiting = runMainLoop(); + if (appExiting) + { + [frameTimer release]; + [[NSApplication sharedApplication] terminate:self]; + } +} + +@end diff --git a/indra/newview/llappviewermacosx-delegate.h b/indra/newview/llappviewermacosx-delegate.h deleted file mode 100644 index 848ccbde62..0000000000 --- a/indra/newview/llappviewermacosx-delegate.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// LLAppDelegate.h -// SecondLife -// -// Created by Geenz on 12/16/12. -// -// - -#import -#import "llopenglview-objc.h" -#include "llappviewermacosx-objc.h" - -@interface LLAppDelegate : NSObject { - LLNSWindow *window; - NSTimer *frameTimer; -} - -@property (assign) IBOutlet LLNSWindow *window; - -- (void) mainLoop; - -@end diff --git a/indra/newview/llappviewermacosx-delegate.mm b/indra/newview/llappviewermacosx-delegate.mm deleted file mode 100644 index 7baeeb1de8..0000000000 --- a/indra/newview/llappviewermacosx-delegate.mm +++ /dev/null @@ -1,57 +0,0 @@ -// -// LLAppDelegate.m -// SecondLife -// -// Created by Geenz on 12/16/12. -// -// - -#import "llappviewermacosx-delegate.h" - -@implementation LLAppDelegate - -@synthesize window; - -- (void)dealloc -{ - [super dealloc]; -} - -- (void) applicationDidFinishLaunching:(NSNotification *)notification -{ - frameTimer = nil; - - setLLNSWindowRef([self window]); - - if (initViewer()) - { - frameTimer = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(mainLoop) userInfo:nil repeats:YES]; - } else { - handleQuit(); - } -} - -- (NSApplicationDelegateReply) applicationShouldTerminate:(NSApplication *)sender -{ - if (!runMainLoop()) - { - handleQuit(); - return NSTerminateCancel; - } else { - [frameTimer release]; - cleanupViewer(); - return NSTerminateNow; - } -} - -- (void) mainLoop -{ - bool appExiting = runMainLoop(); - if (appExiting) - { - [frameTimer release]; - [[NSApplication sharedApplication] terminate:self]; - } -} - -@end diff --git a/indra/newview/llappviewermacosx-objc.h b/indra/newview/llappviewermacosx-objc.h deleted file mode 100644 index ed9017ca5d..0000000000 --- a/indra/newview/llappviewermacosx-objc.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// NSObject_llappviewermacosx_objc.h -// SecondLife -// -// Created by Geenz on 12/16/12. -// -// - -#include -typedef std::tr1::function VoidCallback; -typedef void* ViewerAppRef; - -int createNSApp(int argc, const char **argv); - -bool initViewer(); -void handleQuit(); -bool runMainLoop(); -void initMainLoop(); -void cleanupViewer(); \ No newline at end of file diff --git a/indra/newview/llappviewermacosx-objc.mm b/indra/newview/llappviewermacosx-objc.mm deleted file mode 100644 index ca2090b790..0000000000 --- a/indra/newview/llappviewermacosx-objc.mm +++ /dev/null @@ -1,20 +0,0 @@ -// -// llappviewermacosx.m -// SecondLife -// -// Created by Geenz on 12/12/12. -// -// - -#import -#import -#include "llappviewermacosx-objc.h" -#import "llappviewermacosx-delegate.h" - -int createNSApp(int argc, const char *argv[]) -{ - return NSApplicationMain(argc, argv); -} - - - diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 6e7b91347b..b199405a66 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -31,7 +31,7 @@ #endif #include "llappviewermacosx.h" -#include "llappviewermacosx-objc.h" +#include "llwindowmacosx-objc.h" #include "llcommandlineparser.h" #include "llmemtype.h" -- cgit v1.2.3