From c4e89d9d0c59696e93c006b6234f558ed69134a9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Mar 2019 12:37:05 +0530 Subject: [PATCH] macOS: Consolidate compatibility macros for old SDKs in one place --- glfw/cocoa_init.m | 5 ----- glfw/cocoa_platform.h | 26 ++++++++++++++++++++++++++ glfw/cocoa_window.m | 23 ----------------------- glfw/nsgl_context.m | 4 ---- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/glfw/cocoa_init.m b/glfw/cocoa_init.m index 173f4ac95..a9eda1eef 100644 --- a/glfw/cocoa_init.m +++ b/glfw/cocoa_init.m @@ -26,11 +26,6 @@ #include "internal.h" #include // For MAXPATHLEN -#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 - #define NSEventMaskKeyUp NSKeyUpMask - #define NSEventMaskKeyDown NSKeyDownMask - #define NSEventModifierFlagCommand NSCommandKeyMask -#endif // Change to our application bundle's resources directory, if present // diff --git a/glfw/cocoa_platform.h b/glfw/cocoa_platform.h index aa76486e8..a1523e90d 100644 --- a/glfw/cocoa_platform.h +++ b/glfw/cocoa_platform.h @@ -36,6 +36,32 @@ typedef void* id; typedef void* CVDisplayLinkRef; #endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 + #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat + #define NSEventMaskAny NSAnyEventMask + #define NSEventMaskKeyUp NSKeyUpMask + #define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask + #define NSEventModifierFlagCommand NSCommandKeyMask + #define NSEventModifierFlagControl NSControlKeyMask + #define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask + #define NSEventModifierFlagOption NSAlternateKeyMask + #define NSEventModifierFlagShift NSShiftKeyMask + #define NSEventTypeApplicationDefined NSApplicationDefined + #define NSWindowStyleMaskBorderless NSBorderlessWindowMask + #define NSWindowStyleMaskClosable NSClosableWindowMask + #define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask + #define NSWindowStyleMaskResizable NSResizableWindowMask + #define NSWindowStyleMaskTitled NSTitledWindowMask +#endif + +#if (MAC_OS_X_VERSION_MAX_ALLOWED < 101400) + #define NSPasteboardTypeFileURL NSFilenamesPboardType + #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat + #define NSPasteboardTypeString NSStringPboardType + #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity +#endif + + typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; typedef int (* GLFWcocoatextinputfilterfun)(int,int,unsigned int, unsigned long); typedef int (* GLFWapplicationshouldhandlereopenfun)(int); diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 51846494f..b3bc3b84d 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -32,29 +32,6 @@ // Needed for _NSGetProgname #include -// HACK: The 10.12 SDK adds new symbols and immediately deprecates the old ones -#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 - #define NSWindowStyleMaskBorderless NSBorderlessWindowMask - #define NSWindowStyleMaskClosable NSClosableWindowMask - #define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask - #define NSWindowStyleMaskResizable NSResizableWindowMask - #define NSWindowStyleMaskTitled NSTitledWindowMask - #define NSEventModifierFlagCommand NSCommandKeyMask - #define NSEventModifierFlagControl NSControlKeyMask - #define NSEventModifierFlagOption NSAlternateKeyMask - #define NSEventModifierFlagShift NSShiftKeyMask - #define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask - #define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask - #define NSEventMaskAny NSAnyEventMask - #define NSEventTypeApplicationDefined NSApplicationDefined -#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 // static NSUInteger getStyleMask(_GLFWwindow* window) diff --git a/glfw/nsgl_context.m b/glfw/nsgl_context.m index b3b1b65e5..290cdf093 100644 --- a/glfw/nsgl_context.m +++ b/glfw/nsgl_context.m @@ -27,10 +27,6 @@ #include "internal.h" -#if (MAC_OS_X_VERSION_MAX_ALLOWED < 101400) - #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity -#endif - static void makeContextCurrentNSGL(_GLFWwindow* window) { if (window)