From c020f421e19cfb1bb8012683b54dc18aaa92f452 Mon Sep 17 00:00:00 2001 From: Josep Torra Date: Sat, 20 May 2017 12:34:27 +0200 Subject: [PATCH] examples: fix macOS 9.12 deprecation warnings Add #defines to allow older versions of macOS to use the new constant names. --- tests/examples/gl/cocoa/cocoa-videooverlay.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/examples/gl/cocoa/cocoa-videooverlay.m b/tests/examples/gl/cocoa/cocoa-videooverlay.m index cc209d83d8..75814a71f9 100755 --- a/tests/examples/gl/cocoa/cocoa-videooverlay.m +++ b/tests/examples/gl/cocoa/cocoa-videooverlay.m @@ -22,6 +22,14 @@ #include #include +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +#define NSEventMaskAny NSAnyEventMask +#define NSWindowStyleMaskTitled NSTitledWindowMask +#define NSWindowStyleMaskClosable NSClosableWindowMask +#define NSWindowStyleMaskResizable NSResizableWindowMask +#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask +#endif + /* ============================================================= */ /* */ /* MainWindow */ @@ -48,7 +56,8 @@ m_isClosed = FALSE; self = [super initWithContentRect: contentRect - styleMask: (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask) + styleMask: (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | + NSWindowStyleMaskResizable | NSWindowStyleMaskMiniaturizable) backing: NSBackingStoreBuffered defer: NO screen: nil]; [self setReleasedWhenClosed:NO]; @@ -211,7 +220,7 @@ int main(int argc, char **argv) [window orderFront:window]; while (![window isClosed]) { - NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask + NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate dateWithTimeIntervalSinceNow:1] inMode:NSDefaultRunLoopMode dequeue:YES]; if (event)