aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/cocoa
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-06-16 10:15:31 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-06-16 10:44:44 +0200
commitf6c26ec593ba96d89cb3476c815d6f33a915bfdd (patch)
treecc204a0cdfed5c3431f1e26cc2da10048d8c3474 /src/api/cocoa
parente48c853b9c7a617bf8ba5f31b5fb2088c90c0ee7 (diff)
downloadglutin-f6c26ec593ba96d89cb3476c815d6f33a915bfdd.tar.gz
glutin-f6c26ec593ba96d89cb3476c815d6f33a915bfdd.zip
Handle errors from MakeCurrent and SwapBuffers
Diffstat (limited to 'src/api/cocoa')
-rw-r--r--src/api/cocoa/headless.rs8
-rw-r--r--src/api/cocoa/mod.rs7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/api/cocoa/headless.rs b/src/api/cocoa/headless.rs
index 75cca8d..7cd0f88 100644
--- a/src/api/cocoa/headless.rs
+++ b/src/api/cocoa/headless.rs
@@ -1,3 +1,4 @@
+use ContextError;
use CreationError;
use CreationError::OsError;
use BuilderAttribs;
@@ -61,7 +62,7 @@ impl HeadlessContext {
}
impl GlContext for HeadlessContext {
- unsafe fn make_current(&self) {
+ unsafe fn make_current(&self) -> Result<(), ContextError> {
self.context.makeCurrentContext();
gl::GenFramebuffersEXT(1, &mut framebuffer);
@@ -78,6 +79,8 @@ impl GlContext for HeadlessContext {
if status != gl::FRAMEBUFFER_COMPLETE_EXT {
panic!("Error while creating the framebuffer");
}
+
+ Ok(())
}
fn is_current(&self) -> bool {
@@ -96,7 +99,8 @@ impl GlContext for HeadlessContext {
symbol as *const libc::c_void
}
- fn swap_buffers(&self) {
+ fn swap_buffers(&self) -> Result<(), ContextError> {
+ Ok(())
}
fn get_api(&self) -> ::Api {
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 877aba7..aa408ff 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -8,6 +8,7 @@ use libc;
use Api;
use BuilderAttribs;
+use ContextError;
use GlContext;
use GlProfile;
use GlRequest;
@@ -760,9 +761,10 @@ impl Window {
}
impl GlContext for Window {
- unsafe fn make_current(&self) {
+ unsafe fn make_current(&self) -> Result<(), ContextError> {
let _: () = msg_send![*self.context, update];
self.context.makeCurrentContext();
+ Ok(())
}
fn is_current(&self) -> bool {
@@ -789,8 +791,9 @@ impl GlContext for Window {
symbol as *const _
}
- fn swap_buffers(&self) {
+ fn swap_buffers(&self) -> Result<(), ContextError> {
unsafe { self.context.flushBuffer(); }
+ Ok(())
}
fn get_api(&self) -> ::Api {