From a8fef35dbf320448ba53af77bd8025be5022d9f4 Mon Sep 17 00:00:00 2001 From: Felix Kaaman Date: Mon, 15 Jun 2015 23:28:29 +0200 Subject: Make legacy functions crash on osx core contexts --- src/api/cocoa/mod.rs | 6 ++++++ src/lib.rs | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 877aba7..ba5710d 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -17,6 +17,10 @@ use native_monitor::NativeMonitorId; use objc::runtime::{Class, Object, Sel, BOOL, YES, NO}; use objc::declare::ClassDecl; +use cgl; +use cgl::{CGLEnable, kCGLCECrashOnRemovedFunctions, CGLSetParameter, kCGLCPSurfaceOpacity}; +use cgl::CGLContextObj as CGL_CGLContextObj; + use cocoa::base::{id, nil}; use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize, NSString, NSUInteger}; @@ -572,6 +576,8 @@ impl Window { let value = if builder.vsync { 1 } else { 0 }; cxt.setValues_forParameter_(&value, NSOpenGLContextParameter::NSOpenGLCPSwapInterval); + CGLEnable(cxt.CGLContextObj(), kCGLCECrashOnRemovedFunctions); + Ok((cxt, pf)) } else { Err(CreationError::NotSupported) diff --git a/src/lib.rs b/src/lib.rs index 784ea95..8171a5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,6 +46,8 @@ extern crate dwmapi; #[macro_use] extern crate objc; #[cfg(target_os = "macos")] +extern crate cgl; +#[cfg(target_os = "macos")] extern crate cocoa; #[cfg(target_os = "macos")] extern crate core_foundation; -- cgit v1.2.3