[macOS] Bump min. version to 10.13, and remove deprecated code.

This commit is contained in:
bruvzg 2023-04-24 10:52:50 +03:00
parent f178cad04a
commit fd3e7e25e8
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
2 changed files with 10 additions and 25 deletions

View File

@ -118,10 +118,10 @@ def configure(env: "Environment"):
env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=11.0"]) env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=11.0"])
env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=11.0"]) env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=11.0"])
elif env["arch"] == "x86_64": elif env["arch"] == "x86_64":
print("Building for macOS 10.12+.") print("Building for macOS 10.13+.")
env.Append(ASFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) env.Append(ASFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])
env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])
env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])
env.Append(CCFLAGS=["-fobjc-arc"]) env.Append(CCFLAGS=["-fobjc-arc"])

View File

@ -115,13 +115,7 @@
self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawDuringViewResize; self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawDuringViewResize;
self.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft; self.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft;
if (@available(macOS 10.13, *)) { [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]];
[self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]];
#if !defined(__aarch64__) // Do not build deprectead 10.13 code on ARM.
} else {
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
#endif
}
marked_text = [[NSMutableAttributedString alloc] init]; marked_text = [[NSMutableAttributedString alloc] init];
return self; return self;
} }
@ -321,20 +315,11 @@
Vector<String> files; Vector<String> files;
NSPasteboard *pboard = [sender draggingPasteboard]; NSPasteboard *pboard = [sender draggingPasteboard];
if (@available(macOS 10.13, *)) { NSArray *items = pboard.pasteboardItems;
NSArray *items = pboard.pasteboardItems; for (NSPasteboardItem *item in items) {
for (NSPasteboardItem *item in items) { NSString *url = [item stringForType:NSPasteboardTypeFileURL];
NSString *url = [item stringForType:NSPasteboardTypeFileURL]; NSString *file = [NSURL URLWithString:url].path;
NSString *file = [NSURL URLWithString:url].path; files.push_back(String::utf8([file UTF8String]));
files.push_back(String::utf8([file UTF8String]));
}
#if !defined(__aarch64__) // Do not build deprectead 10.13 code on ARM.
} else {
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
for (NSString *file in filenames) {
files.push_back(String::utf8([file UTF8String]));
}
#endif
} }
Variant v = files; Variant v = files;