examples: fix macOS 9.12 deprecation warnings
authorJosep Torra <jtorra@oblong.com>
Sat, 20 May 2017 10:34:27 +0000 (12:34 +0200)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:28 +0000 (19:32 +0000)
Add #defines to allow older versions of macOS to use the new constant names.

tests/examples/gl/cocoa/cocoa-videooverlay.m

index cc209d8..75814a7 100755 (executable)
 #include <gst/gst.h>
 #include <gst/video/videooverlay.h>
 
+#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)