summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewermacosx.cpp3
-rw-r--r--indra/newview/llfilepicker_mac.mm63
-rw-r--r--indra/newview/llmachineid.cpp4
3 files changed, 57 insertions, 13 deletions
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 1c01d06852..c188bb459f 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -49,6 +49,7 @@
#include "llerrorcontrol.h"
#include "llvoavatarself.h" // for gAgentAvatarp->getFullname()
#include <ApplicationServices/ApplicationServices.h>
+#include "llwindowmacosx_iokit.h"
#ifdef LL_CARBON_CRASH_HANDLER
#include <Carbon/Carbon.h>
#endif
@@ -441,7 +442,7 @@ std::string LLAppViewerMacOSX::generateSerialNumber()
// JC: Sample code from http://developer.apple.com/technotes/tn/tn1103.html
CFStringRef serialNumber = NULL;
- io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
+ io_service_t platformExpert = IOServiceGetMatchingService(kLLIOMainPort,
IOServiceMatching("IOPlatformExpertDevice"));
if (platformExpert)
{
diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm
index 99e93bafbf..3a0bc4005e 100644
--- a/indra/newview/llfilepicker_mac.mm
+++ b/indra/newview/llfilepicker_mac.mm
@@ -26,15 +26,28 @@
#ifdef LL_DARWIN
#import <Cocoa/Cocoa.h>
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
#include <iostream>
#include "llfilepicker_mac.h"
+// Convert a file extension or UTI string into a UTType for use with
+// NSOpenPanel/NSSavePanel's allowedContentTypes.
+static UTType *contentTypeForString(NSString *typeString)
+{
+ UTType *type = [UTType typeWithFilenameExtension:typeString];
+ if (!type)
+ {
+ type = [UTType typeWithIdentifier:typeString];
+ }
+ return type;
+}
+
NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned int flags)
{
int i;
NSOpenPanel *panel = [NSOpenPanel openPanel];
- NSMutableArray *fileTypes = nil;
+ NSMutableArray<UTType *> *fileTypes = nil;
if ( allowed_types && !allowed_types->empty())
@@ -43,9 +56,13 @@ NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned
for (i=0;i<allowed_types->size();++i)
{
- [fileTypes addObject:
- [NSString stringWithCString:(*allowed_types)[i].c_str()
- encoding:[NSString defaultCStringEncoding]]];
+ NSString *typeString = [NSString stringWithCString:(*allowed_types)[i].c_str()
+ encoding:[NSString defaultCStringEncoding]];
+ UTType *type = contentTypeForString(typeString);
+ if (type)
+ {
+ [fileTypes addObject:type];
+ }
}
}
@@ -57,9 +74,9 @@ NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned
[panel setCanChooseFiles: ( (flags & F_FILE)?true:false )];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
- if (fileTypes)
+ if (fileTypes && fileTypes.count > 0)
{
- [panel setAllowedFileTypes:fileTypes];
+ [panel setAllowedContentTypes:fileTypes];
}
else
{
@@ -196,12 +213,25 @@ std::unique_ptr<std::string> doSaveDialog(const std::string* file,
NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
- NSArray *fileType = [extensionns componentsSeparatedByString:@","];
+ NSArray *extensions = [extensionns componentsSeparatedByString:@","];
+
+ NSMutableArray<UTType *> *fileType = [[NSMutableArray alloc] init];
+ for (NSString *ext in extensions)
+ {
+ UTType *type = contentTypeForString(ext);
+ if (type)
+ {
+ [fileType addObject:type];
+ }
+ }
//[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true];
- [panel setAllowedFileTypes:fileType];
+ if (fileType.count > 0)
+ {
+ [panel setAllowedContentTypes:fileType];
+ }
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName];
@@ -231,12 +261,25 @@ void doSaveDialogModeless(const std::string* file,
NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
- NSArray *fileType = [extensionns componentsSeparatedByString:@","];
+ NSArray *extensions = [extensionns componentsSeparatedByString:@","];
+
+ NSMutableArray<UTType *> *fileType = [[NSMutableArray alloc] init];
+ for (NSString *ext in extensions)
+ {
+ UTType *type = contentTypeForString(ext);
+ if (type)
+ {
+ [fileType addObject:type];
+ }
+ }
//[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true];
- [panel setAllowedFileTypes:fileType];
+ if (fileType.count > 0)
+ {
+ [panel setAllowedContentTypes:fileType];
+ }
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName];
diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp
index 0a90cf0699..0373b25143 100644
--- a/indra/newview/llmachineid.cpp
+++ b/indra/newview/llmachineid.cpp
@@ -34,7 +34,7 @@
#include <Wbemidl.h>
#elif LL_DARWIN
#include <CoreFoundation/CoreFoundation.h>
-#include <IOKit/IOKitLib.h>
+#include "llwindowmacosx_iokit.h"
#endif
unsigned char static_unique_id[] = {0,0,0,0,0,0};
unsigned char static_legacy_id[] = {0,0,0,0,0,0};
@@ -350,7 +350,7 @@ bool LLWMIMethods::getGenericSerialNumber(const BSTR &select, const LPCWSTR &var
bool getSerialNumber(unsigned char *unique_id, size_t len)
{
CFStringRef serial_cf_str = NULL;
- io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
+ io_service_t platformExpert = IOServiceGetMatchingService(kLLIOMainPort,
IOServiceMatching("IOPlatformExpertDevice"));
if (platformExpert)
{