aboutsummaryrefslogtreecommitdiffstats
path: root/src/osx
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-11-05 17:01:57 +0100
committertomaka <pierre.krieger1708@gmail.com>2014-11-05 17:01:57 +0100
commit6208c59a48070aa3c58bb0372e95d1c946abe673 (patch)
tree91711433533faa6b44f62eb752d54c0a39129e12 /src/osx
parentc63511e9e670e865b891b6097546fcafeac6446f (diff)
parent584bb3e7df751d55aad189eacd85b1cd6c5aa5c5 (diff)
downloadglutin-6208c59a48070aa3c58bb0372e95d1c946abe673.tar.gz
glutin-6208c59a48070aa3c58bb0372e95d1c946abe673.zip
Merge pull request #100 from tomaka/correct-creation-error
Use a proper error type for window creation
Diffstat (limited to 'src/osx')
-rw-r--r--src/osx/mod.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/osx/mod.rs b/src/osx/mod.rs
index 3dda56a..3d1df8b 100644
--- a/src/osx/mod.rs
+++ b/src/osx/mod.rs
@@ -1,4 +1,4 @@
-use Event;
+use {CreationError, OsError, Event};
use libc;
use std::sync::atomic::AtomicBool;
@@ -48,37 +48,37 @@ impl Deref<Window> for HeadlessContext {
#[cfg(feature = "window")]
impl Window {
- pub fn new(builder: WindowBuilder) -> Result<Window, String> {
+ pub fn new(builder: WindowBuilder) -> Result<Window, CreationError> {
Window::new_impl(builder.dimensions, builder.title.as_slice(), true)
}
}
#[cfg(feature = "headless")]
impl HeadlessContext {
- pub fn new(builder: HeadlessRendererBuilder) -> Result<HeadlessContext, String> {
+ pub fn new(builder: HeadlessRendererBuilder) -> Result<HeadlessContext, CreationError> {
Window::new_impl(Some(builder.dimensions), "", false)
.map(|w| HeadlessContext(w))
}
}
impl Window {
- fn new_impl(dimensions: Option<(uint, uint)>, title: &str, visible: bool) -> Result<Window, String> {
+ fn new_impl(dimensions: Option<(uint, uint)>, title: &str, visible: bool) -> Result<Window, CreationError> {
let app = match Window::create_app() {
Some(app) => app,
- None => { return Err(format!("Couldn't create NSApplication")); },
+ None => { return Err(OsError(format!("Couldn't create NSApplication"))); },
};
let window = match Window::create_window(dimensions.unwrap_or((800, 600)), title) {
Some(window) => window,
- None => { return Err(format!("Couldn't create NSWindow")); },
+ None => { return Err(OsError(format!("Couldn't create NSWindow"))); },
};
let view = match Window::create_view(window) {
Some(view) => view,
- None => { return Err(format!("Couldn't create NSView")); },
+ None => { return Err(OsError(format!("Couldn't create NSView"))); },
};
let context = match Window::create_context(view) {
Some(context) => context,
- None => { return Err(format!("Couldn't create OpenGL context")); },
+ None => { return Err(OsError(format!("Couldn't create OpenGL context"))); },
};
unsafe {