From fec7893de067992b496025e2eb922785a557a368 Mon Sep 17 00:00:00 2001 From: elektrahesse Date: Fri, 17 Sep 2010 20:34:46 +0200 Subject: Fixed events handling on osx to behave correctly on 10.5+ compilation runs. Added ShellEx(std::string &) method to execute local applications based on file type. --- linden/indra/llwindow/llwindowmacosx.cpp | 35 ++++++++++++++++++++++++++------ linden/indra/llwindow/llwindowmacosx.h | 1 + 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'linden') diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp index 7e7e0af..7efba51 100644 --- a/linden/indra/llwindow/llwindowmacosx.cpp +++ b/linden/indra/llwindow/llwindowmacosx.cpp @@ -1153,16 +1153,15 @@ void LLWindowMacOSX::gatherInput() } break; - case kHighLevelEvent: - AEProcessAppleEvent (&evt); - break; - case updateEvt: // We shouldn't be getting these regularly (since our window will be buffered), but we need to handle them correctly... BeginUpdate((WindowRef)evt.message); EndUpdate((WindowRef)evt.message); break; + default: + AEProcessAppleEvent (&evt); + break; } } } @@ -3163,8 +3162,6 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url) OSStatus result = noErr; CFURLRef urlRef = NULL; - llinfos << "Opening URL " << escaped_url << llendl; - CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8); if (stringRef) { @@ -3194,6 +3191,32 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url) } } +void LLWindowMacOSX::ShellEx(const std::string& command) +{ + OSStatus result = noErr; + CFURLRef urlRef = NULL; + + CFStringRef stringRef = CFStringCreateWithCString(NULL, command.c_str(), kCFStringEncodingUTF8); + if (stringRef) + { + urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, stringRef, kCFURLPOSIXPathStyle, false); + CFRelease(stringRef); + } + + if (urlRef) + { + result = LSOpenCFURLRef(urlRef, NULL); + if (result != noErr) + llinfos << "Error " << result << " on open." << llendl; + + CFRelease(urlRef); + } + else + { + llinfos << "Error: couldn't create URL." << llendl; + } +} + BOOL LLWindowMacOSX::dialog_color_picker ( F32 *r, F32 *g, F32 *b) { BOOL retval = FALSE; diff --git a/linden/indra/llwindow/llwindowmacosx.h b/linden/indra/llwindow/llwindowmacosx.h index bf5bfc0..9e87e9f 100644 --- a/linden/indra/llwindow/llwindowmacosx.h +++ b/linden/indra/llwindow/llwindowmacosx.h @@ -113,6 +113,7 @@ public: /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b); /*virtual*/ void interruptLanguageTextInput(); /*virtual*/ void spawnWebBrowser(const std::string& escaped_url); + /*virtual*/ void ShellEx(const std::string& command); static std::vector getDynamicFallbackFontList(); -- cgit v1.1