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>
This commit is contained in:
Elias Naur 2019-03-06 01:22:02 +01:00
Родитель 56dec8b502
Коммит 874a4fb9cd
6 изменённых файлов: 15 добавлений и 9 удалений

Просмотреть файл

@ -12,7 +12,7 @@ package app
// 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>

Просмотреть файл

@ -35,7 +35,11 @@ uint64 threadID() {
- (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 @@ uint64 threadID() {
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 @@ runApp(void) {
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)];

Просмотреть файл

@ -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>

Просмотреть файл

@ -68,9 +68,9 @@ func buildFont(f C.CTFontRef) []byte {
}
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
}

Просмотреть файл

@ -12,6 +12,7 @@ package glutil
// TODO(crawshaw): Support android and windows.
/*
#cgo CFLAGS: -DGL_SILENCE_DEPRECATION
#cgo LDFLAGS: -framework OpenGL
#import <OpenGL/OpenGL.h>
#import <OpenGL/gl3.h>

Просмотреть файл

@ -19,6 +19,7 @@ package gl
#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