From 098b894b4c291ba81daa1909b761b51141025e77 Mon Sep 17 00:00:00 2001 From: cancel Date: Fri, 19 Feb 2021 20:38:39 +0900 Subject: Fix sokol_app.h not building on macOS 10.12 NSPasteboardTypeFileURL is not available on macOS 10.12. This commit wraps the two usages of it in a preprocessor guard. This will cause file drag and drop operations to not work on 10.12, but at least it will build. A way to implement similar drag and drop on 10.12 and earlier exists, but this commit doesn't implement it. I don't know exactly what it would be, and I wouldn't know how to test it with sokol_app.h --- sokol_app.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sokol_app.h b/sokol_app.h index 47c52ca8..256c8755 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -3156,7 +3156,9 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) { backing:(NSBackingStoreType)backingStoreType defer:(BOOL)flag { if (self = [super initWithContentRect:contentRect styleMask:style backing:backingStoreType defer:flag]) { - [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]]; + #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]]; + #endif } return self; } @@ -3170,6 +3172,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) { } - (BOOL)performDragOperation:(id)sender { + #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 NSPasteboard *pboard = [sender draggingPasteboard]; if ([pboard.types containsObject:NSPasteboardTypeFileURL]) { _sapp_clear_drop_buffer(); @@ -3195,6 +3198,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) { } return YES; } + #endif return NO; } @end -- cgit v1.2.3