From 57a1d546e7ea80731a20f0771676f66f0cf595f9 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 20 Jul 2015 19:42:32 +0200 Subject: Add CreationError::NoAvailablePixelFormat --- src/api/cocoa/mod.rs | 2 +- src/api/wgl/mod.rs | 2 +- src/lib.rs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 6fc91b4..5ea57ae 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -603,7 +603,7 @@ impl Window { Err(CreationError::NotSupported) } } else { - Err(CreationError::NotSupported) + Err(CreationError::NoAvailablePixelFormat) } } } diff --git a/src/api/wgl/mod.rs b/src/api/wgl/mod.rs index 54a9a9a..89538f1 100644 --- a/src/api/wgl/mod.rs +++ b/src/api/wgl/mod.rs @@ -573,5 +573,5 @@ fn choose_dummy_pixel_format(iter: I) -> Result } } - backup_id.ok_or(CreationError::NotSupported) + backup_id.ok_or(CreationError::OsError("No available pixel format".to_string())) } diff --git a/src/lib.rs b/src/lib.rs index b543702..9b45ae9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,6 +111,7 @@ pub enum CreationError { NotSupported, RobustnessNotSupported, OpenGlVersionNotSupported, + NoAvailablePixelFormat, } impl CreationError { @@ -122,6 +123,8 @@ impl CreationError { not supported.", CreationError::OpenGlVersionNotSupported => "The requested OpenGL version is not \ supported.", + CreationError::NoAvailablePixelFormat => "Couldn't find any pixel format that matches \ + the criterias.", } } } @@ -471,7 +474,7 @@ impl<'a> BuilderAttribs<'a> { } current_result.or(current_software_result) - .ok_or(CreationError::NotSupported) + .ok_or(CreationError::NoAvailablePixelFormat) } } -- cgit v1.2.3