Skip to content
Snippets Groups Projects
Commit e92e72ff authored by pavelk_productengine's avatar pavelk_productengine
Browse files

MAINT-5106 FIXED [MAC] if SL viewer is not running, clicking on SLURL launches...

MAINT-5106 FIXED [MAC] if SL viewer is not running, clicking on SLURL launches viewer, BUT start location is not set
parent 2bedf20a
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,7 @@ bool runMainLoop(); ...@@ -53,6 +53,7 @@ bool runMainLoop();
void initMainLoop(); void initMainLoop();
void cleanupViewer(); void cleanupViewer();
void handleUrl(const char* url); void handleUrl(const char* url);
void dispatchUrl(std::string url);
/* Defined in llwindowmacosx-objc.mm: */ /* Defined in llwindowmacosx-objc.mm: */
int createNSApp(int argc, const char **argv); int createNSApp(int argc, const char **argv);
......
...@@ -62,9 +62,10 @@ namespace ...@@ -62,9 +62,10 @@ namespace
// They are not used immediately by the app. // They are not used immediately by the app.
int gArgC; int gArgC;
char** gArgV; char** gArgV;
LLAppViewerMacOSX* gViewerAppPtr; LLAppViewerMacOSX* gViewerAppPtr = NULL;
void (*gOldTerminateHandler)() = NULL; void (*gOldTerminateHandler)() = NULL;
std::string gHandleSLURL;
} }
static void exceptionTerminateHandler() static void exceptionTerminateHandler()
...@@ -107,7 +108,11 @@ bool initViewer() ...@@ -107,7 +108,11 @@ bool initViewer()
{ {
LL_WARNS() << "Application init failed." << LL_ENDL; LL_WARNS() << "Application init failed." << LL_ENDL;
} }
else if (!gHandleSLURL.empty())
{
dispatchUrl(gHandleSLURL);
gHandleSLURL = "";
}
return ok; return ok;
} }
...@@ -393,22 +398,31 @@ bool LLAppViewerMacOSX::getMasterSystemAudioMute() ...@@ -393,22 +398,31 @@ bool LLAppViewerMacOSX::getMasterSystemAudioMute()
void handleUrl(const char* url_utf8) void handleUrl(const char* url_utf8)
{ {
if (url_utf8) if (url_utf8 && gViewerAppPtr)
{ {
std::string url = url_utf8; gHandleSLURL = "";
// Safari 3.2 silently mangles secondlife:///app/ URLs into dispatchUrl(url_utf8);
// 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)
{
url.replace(0, prefix.length(), "secondlife:///app/");
}
LLMediaCtrl* web = NULL;
const bool trusted_browser = false;
LLURLDispatcher::dispatch(url, "", web, trusted_browser);
} }
else if (url_utf8)
{
gHandleSLURL = url_utf8;
}
}
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)
{
url.replace(0, prefix.length(), "secondlife:///app/");
}
LLMediaCtrl* web = NULL;
const bool trusted_browser = false;
LLURLDispatcher::dispatch(url, "", web, trusted_browser);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment