From cbab3b56de292ac6b384add64b5665d203b21072 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 3 Oct 2018 20:51:25 +0530 Subject: [PATCH] Fixes for compilation on mojave, needs testing --- glfw/cocoa_window.m | 13 +++++++++---- glfw/glfw.py | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index a6d13acbe..4081287d8 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -50,6 +50,11 @@ #define NSEventTypeKeyUp NSKeyUp #endif +#if (MAC_OS_X_VERSION_MAX_ALLOWED < 101400) + #define NSPasteboardTypeFileURL NSFilenamesPboardType + #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat + #define NSPasteboardTypeString NSStringPboardType +#endif // Returns the style mask corresponding to the window settings // @@ -550,7 +555,7 @@ static GLFWapplicationshouldhandlereopenfun handle_reopen_callback = NULL; [self updateTrackingAreas]; [self registerForDraggedTypes:[NSArray arrayWithObjects: - NSFilenamesPboardType, nil]]; + NSPasteboardTypeFileURL, nil]]; } return self; @@ -915,7 +920,7 @@ is_ascii_control_char(char x) { - (BOOL)performDragOperation:(id )sender { NSPasteboard* pasteboard = [sender draggingPasteboard]; - NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType]; + NSArray* files = [pasteboard propertyListForType:NSPasteboardTypeFileURL]; const NSRect contentRect = [window->ns.view frame]; _glfwInputCursorPos(window, @@ -1940,7 +1945,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, hasAlpha:YES isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace - bitmapFormat:NSAlphaNonpremultipliedBitmapFormat + bitmapFormat:NSBitmapFormatAlphaNonpremultiplied bytesPerRow:src->width * 4 bitsPerPixel:32]; if (rep == nil) @@ -2002,7 +2007,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) void _glfwPlatformSetClipboardString(const char* string) { - NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil]; + NSArray* types = [NSArray arrayWithObjects:NSPasteboardTypeString, nil]; NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; [pasteboard declareTypes:types owner:nil]; diff --git a/glfw/glfw.py b/glfw/glfw.py index 5794f6ca5..13cb7e898 100755 --- a/glfw/glfw.py +++ b/glfw/glfw.py @@ -32,10 +32,11 @@ def init_env(env, pkg_config, at_least_version, test_compile, module='x11'): ans.cflags.append('-pthread') ans.ldpaths.append('-pthread') ans.cflags.append('-fpic') - ans.cflags.append('-D_GLFW_' + module.upper()) - ans.cflags.append('-D_GLFW_BUILD_DLL') + ans.cppflags.append('-D_GLFW_' + module.upper()) + ans.cppflags.append('-D_GLFW_BUILD_DLL') if is_macos: + ans.cppflags.append('-DGL_SILENCE_DEPRECATION') ans.ldpaths.extend( "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo". split()