diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 697429145e53a7bf134d4586cbb0dcdf1be009b5..82933435ebfae6e373752dcb3df31f18a41581cc 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -301,6 +301,7 @@ if(LL_TESTS) set(test_libs llui llmessage llcorehttp llcommon ${HUNSPELL_LIBRARY} ${LLCOMMON_LIBRARIES} + ${LLWINDOW_LIBRARIES} ${BOOST_COROUTINE_LIBRARY} ${BOOST_CONTEXT_LIBRARY} ${BOOST_SYSTEM_LIBRARY} ${WINDOWS_LIBRARIES}) if(NOT LINUX) diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 88d69ef97c6e8fdeaf8fc1dac1d444a5e754aa97..b8b970bf685df2cd32f74f0085f0a8edd14e74b5 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -36,6 +36,11 @@ #include <boost/regex.hpp> +// Little Caesars Stub Cruft +bool pumpMainLoop() { return true; } +void constructViewer() { } +void cleanupViewer() { } +void handleUrl(const char*) { } // namespace LLExperienceCache // { diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 031601efec5122b2f200e71a0af48b84401a1706..c639e9a8055df93454b22015aabdec8b9fc254b4 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -109,6 +109,7 @@ if (DARWIN) llwindowmacosx.cpp llwindowmacosx-objc.mm llopenglview-objc.mm + llappdelegate-objc.mm ) list(APPEND llwindow_HEADER_FILES llkeyboardmacosx.h diff --git a/indra/newview/llappdelegate-objc.mm b/indra/llwindow/llappdelegate-objc.mm similarity index 84% rename from indra/newview/llappdelegate-objc.mm rename to indra/llwindow/llappdelegate-objc.mm index 3eada9b81716c11db7a6c02ef53025bf719faeee..e4d1b029fedd50b1dcf0cb93c43a7db3e363e898 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/llwindow/llappdelegate-objc.mm @@ -25,18 +25,11 @@ */ #import "llappdelegate-objc.h" -#if defined(LL_BUGSPLAT) -#include <boost/filesystem.hpp> -#include <vector> -@import BugsplatMac; -// derived from BugsplatMac's BugsplatTester/AppDelegate.m -@interface LLAppDelegate () <BugsplatStartupManagerDelegate> -@end -#endif #include "llwindowmacosx-objc.h" -#include "llappviewermacosx-for-objc.h" + #include <Carbon/Carbon.h> // Used for Text Input Services ("Safe" API - it's supported) +extern void constructViewer(); // found in newview/llappviewermacosx.cpp @implementation LLNSApplication @@ -64,24 +57,14 @@ - (void) applicationDidFinishLaunching:(NSNotification *)notification { - // Call constructViewer() first so our logging subsystem is in place. This - // risks missing crashes in the LLAppViewerMacOSX constructor, but for - // present purposes it's more important to get the startup sequence - // properly logged. - // Someday I would like to modify the logging system so that calls before - // it's initialized are cached in a std::ostringstream and then, once it's - // initialized, "played back" into whatever handlers have been set up. - constructViewer(); - -#if defined(LL_BUGSPLAT) - // Engage BugsplatStartupManager *before* calling initViewer() to handle - // any crashes during initialization. - // https://www.bugsplat.com/docs/platforms/os-x#initialization - [BugsplatStartupManager sharedManager].autoSubmitCrashReport = YES; - [BugsplatStartupManager sharedManager].askUserDetails = NO; - [BugsplatStartupManager sharedManager].delegate = self; - [[BugsplatStartupManager sharedManager] start]; -#endif + // Call constructViewer() first so our logging subsystem is in place. This + // risks missing crashes in the LLAppViewerMacOSX constructor, but for + // present purposes it's more important to get the startup sequence + // properly logged. + // Someday I would like to modify the logging system so that calls before + // it's initialized are cached in a std::ostringstream and then, once it's + // initialized, "played back" into whatever handlers have been set up. + constructViewer(); frameTimer = nil; @@ -221,3 +204,19 @@ } @end + +@implementation LLNSMenu + +- (IBAction)toggleOSXNotification:(id)sender; { + NSLog(@"Toggling Notifications"); +} + +- (IBAction)toggleOSXNotificationScripts:(id)sender { + NSLog(@"Toggling Script notifications"); +} + +- (IBAction)toggleOSXNotificationSounds:(id)sender { + NSLog(@"Toggling notification sounds"); +} + +@end diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index c428e0004464dc7c8b9342f5a5302b4699f96156..16da6cec423cac2d8621370998cd7ce937b7b60d 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1794,34 +1794,6 @@ LLSD LLWindowMacOSX::getNativeKeyData() return result; } -BOOL LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b) -{ - BOOL retval = FALSE; - OSErr error = noErr; - NColorPickerInfo info; - - memset(&info, 0, sizeof(info)); - info.theColor.color.rgb.red = (UInt16)(*r * 65535.f); - info.theColor.color.rgb.green = (UInt16)(*g * 65535.f); - info.theColor.color.rgb.blue = (UInt16)(*b * 65535.f); - info.placeWhere = kCenterOnMainScreen; - - error = NPickColor(&info); - - if (error == noErr) - { - retval = info.newColorChosen; - if (info.newColorChosen) - { - *r = ((float) info.theColor.color.rgb.red) / 65535.0; - *g = ((float) info.theColor.color.rgb.green) / 65535.0; - *b = ((float) info.theColor.color.rgb.blue) / 65535.0; - } - } - - return (retval); -} - void *LLWindowMacOSX::getPlatformWindow() { // NOTE: this will be NULL in fullscreen mode. Plan accordingly. diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 5646a5d1728d9653fb50dc077a8b02bc77a16855..b034a61e441f7d5d756311e98484391d9caca602 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -105,8 +105,6 @@ public: /*virtual*/ void beforeDialog(); /*virtual*/ void afterDialog(); - /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b); - /*virtual*/ void *getPlatformWindow(); /*virtual*/ void bringToFront() {}; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 78e1f9852b87914ab090196d997f51377839c544..aa3f60fa203b4f9d20364b279c93c82de5dadb0a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1477,14 +1477,6 @@ if (DARWIN) llappviewermacosx-objc.h llfilepicker_mac.h) - # This should be compiled with the viewer. - LIST(APPEND viewer_SOURCE_FILES llappdelegate-objc.mm) - set_source_files_properties( - llappdelegate-objc.mm - PROPERTIES - COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" - ) - find_library(AGL_LIBRARY AGL) find_library(APPKIT_LIBRARY AppKit) find_library(COCOA_LIBRARY Cocoa) @@ -2456,38 +2448,50 @@ if (LL_TESTS) ${RT_LIBRARY} ${BOOST_COROUTINE_LIBRARY} ${BOOST_CONTEXT_LIBRARY} - ) + ) - LL_ADD_INTEGRATION_TEST(llsechandler_basic + add_library(secapi_object OBJECT + llmachineid.cpp + llsecapi.cpp + llsecapicerthandler.cpp llsechandler_basic.cpp - "${test_libs}" + ) + + set(secapi_libs + ${secapi_object} +# ${test_libs} + ) +message("${secapi_libs}") + LL_ADD_INTEGRATION_TEST(llsechandler_basic + "" + "${secapi_libs}" ) LL_ADD_INTEGRATION_TEST(llsecapi - llsecapi.cpp - "${test_libs}" + "" + "${secapi_libs}" ) set(llslurl_test_sources - llslurl.cpp - llviewernetwork.cpp - ) + llslurl.cpp + llviewernetwork.cpp + ) LL_ADD_INTEGRATION_TEST(llslurl - "${llslurl_test_sources}" + "${llslurl_test_sources}" "${test_libs}" ) set(llviewernetwork_test_sources - llviewernetwork.cpp - lllogininstance.cpp - ) + llviewernetwork.cpp + lllogininstance.cpp + ) - #LL_ADD_INTEGRATION_TEST(llviewernetwork - # "${llviewernetwork_test_sources}" - # "${test_libs}" - # ) + LL_ADD_INTEGRATION_TEST(llviewernetwork + "${llviewernetwork_test_sources}" + "${test_libs}" + ) LL_ADD_INTEGRATION_TEST(llviewerassetstats llviewerassetstats.cpp diff --git a/indra/newview/llappviewermacosx-for-objc.h b/indra/newview/llappviewermacosx-for-objc.h deleted file mode 100644 index 37e8a3917a928f483585f0402ab61dc25e1d4fbf..0000000000000000000000000000000000000000 --- a/indra/newview/llappviewermacosx-for-objc.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file llappviewermacosx-for-objc.h - * @author Nat Goodspeed - * @date 2018-06-15 - * @brief llappviewermacosx.h publishes the C++ API for - * llappviewermacosx.cpp, just as - * llappviewermacosx-objc.h publishes the Objective-C++ API for - * llappviewermacosx-objc.mm. - * - * This header is intended to publish for Objective-C++ consumers a - * subset of the C++ API presented by llappviewermacosx.cpp. It's a - * subset because, if an Objective-C++ consumer were to #include - * the full llappviewermacosx.h, we would almost surely run into - * trouble due to the discrepancy between Objective-C++'s BOOL versus - * classic Microsoft/Linden BOOL. - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Copyright (c) 2018, Linden Research, Inc. - * $/LicenseInfo$ - */ - -#if ! defined(LL_LLAPPVIEWERMACOSX_FOR_OBJC_H) -#define LL_LLAPPVIEWERMACOSX_FOR_OBJC_H - -#include <string> - -void constructViewer(); -bool initViewer(); -void handleUrl(const char* url_utf8); -bool pumpMainLoop(); -void handleQuit(); -void cleanupViewer(); -void infos(const std::string& message); - -// This struct is malleable; it only serves as a way to convey a number of -// fields from llappviewermacosx.cpp's CrashMetadata_instance() function to the -// consuming functions in llappdelegate-objc.mm. As long as both those sources -// are compiled with this same header, the content and order of CrashMetadata -// can change as needed. -struct CrashMetadata -{ - std::string logFilePathname; - std::string userSettingsPathname; - std::string staticDebugPathname; - std::string OSInfo; - std::string agentFullname; - std::string regionName; - std::string fatalMessage; -}; - -CrashMetadata& CrashMetadata_instance(); - -#endif /* ! defined(LL_LLAPPVIEWERMACOSX_FOR_OBJC_H) */ diff --git a/indra/newview/llappviewermacosx-objc.h b/indra/newview/llappviewermacosx-objc.h index c6dcec8e34e7161b3d9424f12cf75e29e3059095..146d039ad723660fd76a7838bcc1a04ef7a665b5 100644 --- a/indra/newview/llappviewermacosx-objc.h +++ b/indra/newview/llappviewermacosx-objc.h @@ -31,6 +31,6 @@ #include <vector> //Why? Because BOOL -void launchApplication(const std::string* app_name, const std::vector<std::string>* args); +void launchApplication(const std::string& app_name, const std::vector<std::string>& args); #endif // LL_LLAPPVIEWERMACOSX_OBJC_H diff --git a/indra/newview/llappviewermacosx-objc.mm b/indra/newview/llappviewermacosx-objc.mm index 8e1c9cf0eb957bba555cb355bbeb2093360b9965..22e85185b68a0d365383ddaaeb2f7375acdcb721 100644 --- a/indra/newview/llappviewermacosx-objc.mm +++ b/indra/newview/llappviewermacosx-objc.mm @@ -24,33 +24,31 @@ * $/LicenseInfo$ */ -#if !defined LL_DARWIN - #error "Use only with Mac OS X" +#ifndef LL_DARWIN +# error "Use only with Mac OS X" #endif -#import <Cocoa/Cocoa.h> -#include <iostream> - #include "llappviewermacosx-objc.h" +#import <Cocoa/Cocoa.h> -void launchApplication(const std::string* app_name, const std::vector<std::string>* args) +void launchApplication(const std::string& app_name, const std::vector<std::string>& args) { - if (app_name->empty()) return; + if (app_name.empty()) return; NSMutableString* app_name_ns = [NSMutableString stringWithString:[[NSBundle mainBundle] resourcePath]]; //Path to resource dir - [app_name_ns appendFormat:@"/%@", [NSString stringWithCString:app_name->c_str() + [app_name_ns appendFormat:@"/%@", [NSString stringWithCString:app_name.c_str() encoding:[NSString defaultCStringEncoding]]]; NSMutableArray *args_ns = nil; args_ns = [[NSMutableArray alloc] init]; - for (int i=0; i < args->size(); ++i) + for (int i=0; i < args.size(); ++i) { - NSLog(@"Adding string %s", (*args)[i].c_str()); + NSLog(@"Adding string %s", args[i].c_str()); [args_ns addObject: - [NSString stringWithCString:(*args)[i].c_str() + [NSString stringWithCString:args[i].c_str() encoding:[NSString defaultCStringEncoding]]]; } diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 71de745a58f44e593fc5feb1fc18ea82337eb077..50eeb07bd2a90bf8f1326d5a1f5417965ff8c1e8 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -36,7 +36,6 @@ #include "llappviewermacosx-objc.h" #include "llappviewermacosx.h" -#include "llappviewermacosx-for-objc.h" #include "llwindowmacosx-objc.h" #include "llcommandlineparser.h" #include "llsdserialize.h" @@ -147,76 +146,15 @@ void cleanupViewer() { if(!LLApp::isError()) { - if (gViewerAppPtr) + if (gViewerAppPtr) { gViewerAppPtr->cleanup(); + } } delete gViewerAppPtr; gViewerAppPtr = NULL; } -// The BugsplatMac API is structured as a number of different method -// overrides, each returning a different piece of metadata. But since we -// obtain such metadata by opening and parsing a file, it seems ridiculous to -// reopen and reparse it for every individual string desired. What we want is -// to open and parse the file once, retaining the data for subsequent -// requests. That's why this is an LLSingleton. -// Another approach would be to provide a function that simply returns -// CrashMetadata, storing the struct in LLAppDelegate, but nat doesn't know -// enough Objective-C++ to code that. We'd still have to detect which of the -// method overrides is called first so that the results are order-insensitive. -class CrashMetadataSingleton: public CrashMetadata, public LLSingleton<CrashMetadataSingleton> -{ - LLSINGLETON(CrashMetadataSingleton); - - // convenience method to log each metadata field retrieved by constructor - std::string get_metadata(const LLSD& info, const LLSD::String& key) const - { - std::string data(info[key].asString()); - LL_INFOS() << " " << key << "='" << data << "'" << LL_ENDL; - return data; - } -}; - -// Populate the fields of our public base-class struct. -CrashMetadataSingleton::CrashMetadataSingleton() -{ - // Note: we depend on being able to read the static_debug_info.log file - // from the *previous* run before we overwrite it with the new one for - // *this* run. LLAppViewer initialization must happen in the Right Order. - staticDebugPathname = *gViewerAppPtr->getStaticDebugFile(); - std::ifstream static_file(staticDebugPathname); - LLSD info; - if (! static_file.is_open()) - { - LL_INFOS() << "Can't open '" << staticDebugPathname - << "'; no metadata about previous run" << LL_ENDL; - } - else if (! LLSDSerialize::deserialize(info, static_file, LLSDSerialize::SIZE_UNLIMITED)) - { - LL_INFOS() << "Can't parse '" << staticDebugPathname - << "'; no metadata about previous run" << LL_ENDL; - } - else - { - LL_INFOS() << "Metadata from '" << staticDebugPathname << "':" << LL_ENDL; - logFilePathname = get_metadata(info, "SLLog"); - userSettingsPathname = get_metadata(info, "SettingsFilename"); - OSInfo = get_metadata(info, "OSInfo"); - agentFullname = get_metadata(info, "LoginName"); - // Translate underscores back to spaces - LLStringUtil::replaceChar(agentFullname, '_', ' '); - regionName = get_metadata(info, "CurrentRegion"); - fatalMessage = get_metadata(info, "FatalMessage"); - } -} - -// Avoid having to compile all of our LLSingleton machinery in Objective-C++. -CrashMetadata& CrashMetadata_instance() -{ - return CrashMetadataSingleton::instance(); -} - void infos(const std::string& message) { LL_INFOS() << message << LL_ENDL; @@ -242,7 +180,7 @@ bool LLAppViewerMacOSX::init() { bool success = LLAppViewer::init(); -#if LL_SEND_CRASH_REPORTS +#if 0 //LL_SEND_CRASH_REPORTS if (success) { LLAppViewer* pApp = LLAppViewer::instance(); @@ -360,9 +298,7 @@ void LLAppViewerMacOSX::initCrashReporting(bool reportFreeze) std::string appname = gDirUtilp->getExecutableFilename(); std::string str[] = { "-pid", pid_str.str(), "-dumpdir", logdir, "-procname", appname.c_str() }; std::vector< std::string > args( str, str + ( sizeof ( str ) / sizeof ( std::string ) ) ); - LL_WARNS() << "about to launch mac-crash-logger" << pid_str.str() - << " " << logdir << " " << appname << LL_ENDL; - launchApplication(&command_str, &args); + launchApplication(command_str, args); } std::string LLAppViewerMacOSX::generateSerialNumber() @@ -413,12 +349,19 @@ void dispatchUrl(std::string url) // Safari 3.2 silently mangles secondlife:///app/ URLs into // secondlife:/app/ (only one leading slash). // Fix them up to meet the URL specification. JC - const std::string prefix = "secondlife:/app/"; - std::string test_prefix = url.substr(0, prefix.length()); - LLStringUtil::toLower(test_prefix); - if (test_prefix == prefix) + const std::string sl_prefix = "secondlife:/app/"; + const std::string xgrid_prefix = "x-grid-info:/app/"; + std::string test_sl_prefix = url.substr(0, sl_prefix.length()); + std::string test_xgrid_prefix = url.substr(0, xgrid_prefix.length()); + LLStringUtil::toLower(test_sl_prefix); + LLStringUtil::toLower(test_xgrid_prefix); + if (test_sl_prefix == sl_prefix) + { + url.replace(0, sl_prefix.length(), "secondlife:///app/"); + } + else if (test_xgrid_prefix == xgrid_prefix) { - url.replace(0, prefix.length(), "secondlife:///app/"); + url.replace(0, xgrid_prefix.length(), "x-grid-info:///app/"); } LLMediaCtrl* web = NULL; diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index f44fc12b60ab9cb1718a6774091f925fc0f577f1..0e2efe4e35592af9154e2f6e19fc00ad98bb1358 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -180,30 +180,6 @@ void LLFloaterColorPicker::showUI () setVisible ( TRUE ); setFocus ( TRUE ); setRevertOnCancel(FALSE); - - // HACK: if system color picker is required - close the SL one we made and use default system dialog - if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) ) - { - LLColorSwatchCtrl* swatch = getSwatch (); - - setVisible ( FALSE ); - - // code that will get switched in for default system color picker - if ( swatch ) - { - LLColor4 curCol = swatch->get (); - send_agent_pause(); - getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] ); - send_agent_resume(); - - setOrigRgb ( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] ); - setCurRgb( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] ); - - LLColorSwatchCtrl::onColorChanged ( swatch, LLColorSwatchCtrl::COLOR_CHANGE ); - } - - closeFloater(); - } } ////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index cf90a08c95d46fd22c707a7eb4529d5090d7e5a6..a99cb03f5830df5c47822cc264308002378fda61 100644 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -28,6 +28,7 @@ #include "../llviewerprecompiledheaders.h" #include "../test/lltut.h" #include "../llsecapi.h" +#include "../llsecapicerthandler.h" #include "../llsechandler_basic.h" #include "../../llxml/llcontrol.h" @@ -54,10 +55,11 @@ LLControlGroup gSavedSettings("test"); LLSecAPIBasicHandler::LLSecAPIBasicHandler() {} void LLSecAPIBasicHandler::init() {} LLSecAPIBasicHandler::~LLSecAPIBasicHandler() {} -LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert) { return nullptr; } -LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(X509* openssl_cert) { return nullptr; } -LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(X509_STORE_CTX* chain) { return nullptr; } -LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id) { return nullptr; } +LLPointer<LLCertificate> LLSecAPIBasicCertHandler::getCertificate(const std::string& pem_cert) { return nullptr; } +LLPointer<LLCertificate> LLSecAPIBasicCertHandler::getCertificate(X509* openssl_cert) { return nullptr; } +LLPointer<LLCertificateChain> LLSecAPIBasicCertHandler::getCertificateChain(X509_STORE_CTX* chain) { return nullptr; } +LLPointer<LLCertificateStore> LLSecAPIBasicCertHandler::getCertificateStore(const std::string& store_id) { return nullptr; } + void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type, const std::string& data_id, const LLSD& data) { } LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type, const std::string& data_id) { return LLSD(); } void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type, const std::string& data_id) { }