From 4001e7e6bdf2ac6598ccbc39eca37c1810e399a7 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 13 Jan 2017 10:52:35 +0200 Subject: [PATCH] Fixed compilation with macOS SDK earlier than 10.7 --- src/posix/cocoa/i_common.h | 9 +++++++-- src/posix/cocoa/i_video.mm | 13 +++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/posix/cocoa/i_common.h b/src/posix/cocoa/i_common.h index 9cedb02627..0fc46e3775 100644 --- a/src/posix/cocoa/i_common.h +++ b/src/posix/cocoa/i_common.h @@ -184,14 +184,19 @@ typedef NSInteger NSApplicationActivationPolicy; - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag; @end +@interface NSView(Compatibility) +- (NSRect)convertRectToBacking:(NSRect)aRect; +@end + @interface NSScreen(HiDPIStubs) - (NSRect)convertRectToBacking:(NSRect)aRect; @end static const NSWindowCollectionBehavior NSWindowCollectionBehaviorFullScreenAuxiliary = NSWindowCollectionBehavior(1 << 8); -static const NSOpenGLPixelFormatAttribute NSOpenGLPFAOpenGLProfile(96); -static const NSOpenGLPixelFormatAttribute NSOpenGLProfileVersion3_2Core(0x3200); +static const auto NSOpenGLPFAOpenGLProfile = NSOpenGLPixelFormatAttribute(96); +static const auto NSOpenGLProfileVersionLegacy = NSOpenGLPixelFormatAttribute(0x1000); +static const auto NSOpenGLProfileVersion3_2Core = NSOpenGLPixelFormatAttribute(0x3200); #endif // prior to 10.7 diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 08a563b257..2ee7458a8a 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -69,6 +69,19 @@ #undef Class +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 + +@implementation NSView(Compatibility) + +- (NSRect)convertRectToBacking:(NSRect)aRect +{ + return [self convertRect:aRect toView:[self superview]]; +} + +@end + +#endif // prior to 10.7 + @implementation NSWindow(ExitAppOnClose) - (void)exitAppOnClose