app,exp,gl: fix build

Ignore deprecation warning for OpenGL and replace deprecated enum
names.

Change-Id: Ie07c566f1b28610add074dc4da8ab66399cef94b
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/165578
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/app/darwin_desktop.go b/app/darwin_desktop.go
index ecbc45a..5a0302f 100644
--- a/app/darwin_desktop.go
+++ b/app/darwin_desktop.go
@@ -12,7 +12,7 @@
 // than screens with touch panels.
 
 /*
-#cgo CFLAGS: -x objective-c
+#cgo CFLAGS: -x objective-c -DGL_SILENCE_DEPRECATION
 #cgo LDFLAGS: -framework Cocoa -framework OpenGL
 #import <Carbon/Carbon.h> // for HIToolbox/Events.h
 #import <Cocoa/Cocoa.h>
diff --git a/app/darwin_desktop.m b/app/darwin_desktop.m
index b4f2e8d..615c29b 100644
--- a/app/darwin_desktop.m
+++ b/app/darwin_desktop.m
@@ -35,7 +35,11 @@
 - (void)prepareOpenGL {
 	[self setWantsBestResolutionOpenGLSurface:YES];
 	GLint swapInt = 1;
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
 	[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
+#pragma clang diagnostic pop
 
 	// Using attribute arrays in OpenGL 3.3 requires the use of a VBA.
 	// But VBAs don't exist in ES 2. So we bind a default one.
@@ -168,7 +172,7 @@
 	uint8_t direction;
 	if ([theEvent isARepeat]) {
 		direction = 0;
-	} else if (theEvent.type == NSKeyDown) {
+	} else if (theEvent.type == NSEventTypeKeyDown) {
 		direction = 1;
 	} else {
 		direction = 2;
@@ -209,13 +213,13 @@
 	NSRect rect = NSMakeRect(0, 0, 600, 800);
 
 	NSWindow* window = [[[NSWindow alloc] initWithContentRect:rect
-			styleMask:NSTitledWindowMask
+			styleMask:NSWindowStyleMaskTitled
 			backing:NSBackingStoreBuffered
 			defer:NO]
 		autorelease];
-	window.styleMask |= NSResizableWindowMask;
-	window.styleMask |= NSMiniaturizableWindowMask ;
-	window.styleMask |= NSClosableWindowMask;
+	window.styleMask |= NSWindowStyleMaskResizable;
+	window.styleMask |= NSWindowStyleMaskMiniaturizable;
+	window.styleMask |= NSWindowStyleMaskClosable;
 	window.title = name;
 	[window cascadeTopLeftFromPoint:NSMakePoint(20,20)];
 
diff --git a/app/darwin_ios.go b/app/darwin_ios.go
index 935b41b..f21816c 100644
--- a/app/darwin_ios.go
+++ b/app/darwin_ios.go
@@ -8,7 +8,7 @@
 package app
 
 /*
-#cgo CFLAGS: -x objective-c
+#cgo CFLAGS: -x objective-c -DGL_SILENCE_DEPRECATION
 #cgo LDFLAGS: -framework Foundation -framework UIKit -framework GLKit -framework OpenGLES -framework QuartzCore
 #include <sys/utsname.h>
 #include <stdint.h>
diff --git a/exp/font/font_darwin.go b/exp/font/font_darwin.go
index e82713c..7f9f1d3 100644
--- a/exp/font/font_darwin.go
+++ b/exp/font/font_darwin.go
@@ -68,9 +68,9 @@
 }
 
 func buildDefault() ([]byte, error) {
-	return buildFont(C.CTFontCreateUIFontForLanguage(C.kCTFontSystemFontType, 0, nil)), nil
+	return buildFont(C.CTFontCreateUIFontForLanguage(C.kCTFontSystemFontType, 0, 0)), nil
 }
 
 func buildMonospace() ([]byte, error) {
-	return buildFont(C.CTFontCreateUIFontForLanguage(C.kCTFontUserFixedPitchFontType, 0, nil)), nil
+	return buildFont(C.CTFontCreateUIFontForLanguage(C.kCTFontUserFixedPitchFontType, 0, 0)), nil
 }
diff --git a/exp/gl/glutil/context_darwin_desktop.go b/exp/gl/glutil/context_darwin_desktop.go
index e9e9355..42488a2 100644
--- a/exp/gl/glutil/context_darwin_desktop.go
+++ b/exp/gl/glutil/context_darwin_desktop.go
@@ -12,6 +12,7 @@
 // TODO(crawshaw): Support android and windows.
 
 /*
+#cgo CFLAGS: -DGL_SILENCE_DEPRECATION
 #cgo LDFLAGS: -framework OpenGL
 #import <OpenGL/OpenGL.h>
 #import <OpenGL/gl3.h>
diff --git a/gl/work.go b/gl/work.go
index 3a8bacf..9f340c1 100644
--- a/gl/work.go
+++ b/gl/work.go
@@ -19,6 +19,7 @@
 #cgo darwin,amd64,!ios  CFLAGS: -Dos_osx
 #cgo darwin,arm         CFLAGS: -Dos_ios
 #cgo darwin,arm64       CFLAGS: -Dos_ios
+#cgo darwin             CFLAGS: -DGL_SILENCE_DEPRECATION
 #cgo linux              CFLAGS: -Dos_linux
 #cgo openbsd            CFLAGS: -Dos_openbsd