aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform/windows
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-09-21 14:15:41 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-09-21 14:15:41 +0200
commit6787f1d43493f0f8c2310ac3c3d5cb409d13ec40 (patch)
tree03056bc49bd5ec0da9e155176a74c2d23a8fc603 /src/platform/windows
parentf51ace4c7885fa25c146c24181c4d87f5632de3e (diff)
parent62bafe2130db5aaf32bd46091581086ae435e4cf (diff)
downloadglutin-6787f1d43493f0f8c2310ac3c3d5cb409d13ec40.tar.gz
glutin-6787f1d43493f0f8c2310ac3c3d5cb409d13ec40.zip
Merge pull request #603 from tomaka/gl-attribs
Separate the builder attributes into multiple substates
Diffstat (limited to 'src/platform/windows')
-rw-r--r--src/platform/windows/mod.rs26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/platform/windows/mod.rs b/src/platform/windows/mod.rs
index 7087a23..af9261f 100644
--- a/src/platform/windows/mod.rs
+++ b/src/platform/windows/mod.rs
@@ -7,11 +7,13 @@ pub use api::win32::{WindowProxy, PollEventsIterator, WaitEventsIterator};
use libc;
use Api;
-use BuilderAttribs;
use ContextError;
use CreationError;
use PixelFormat;
+use PixelFormatRequirements;
+use GlAttributes;
use GlContext;
+use WindowAttributes;
use api::egl::ffi::egl::Egl;
use api::egl;
@@ -57,8 +59,11 @@ pub struct Window(win32::Window);
impl Window {
/// See the docs in the crate root file.
- pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> {
- win32::Window::new(builder, EGL.as_ref().map(|w| &w.0)).map(|w| Window(w))
+ pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements,
+ opengl: &GlAttributes<&Window>) -> Result<Window, CreationError>
+ {
+ win32::Window::new(window, pf_reqs, &opengl.clone().map_sharing(|w| &w.0),
+ EGL.as_ref().map(|w| &w.0)).map(|w| Window(w))
}
}
@@ -85,14 +90,15 @@ pub enum HeadlessContext {
}
impl HeadlessContext {
- pub fn new(mut builder: BuilderAttribs) -> Result<HeadlessContext, CreationError> {
- builder.visible = false;
-
+ pub fn new(dimensions: (u32, u32), pf_reqs: &PixelFormatRequirements,
+ opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError>
+ {
// if EGL is available, we try using EGL first
// if EGL returns an error, we try the hidden window method
if let &Some(ref egl) = &*EGL {
- let context = EglContext::new(egl.0.clone(), &builder, egl::NativeDisplay::Other(None))
- .and_then(|prototype| prototype.finish_pbuffer())
+ let context = EglContext::new(egl.0.clone(), pf_reqs, &opengl.clone().map_sharing(|_| unimplemented!()), // TODO:
+ egl::NativeDisplay::Other(None))
+ .and_then(|prototype| prototype.finish_pbuffer(dimensions))
.map(|ctxt| HeadlessContext::EglPbuffer(ctxt));
if let Ok(context) = context {
@@ -100,7 +106,9 @@ impl HeadlessContext {
}
}
- let window = try!(win32::Window::new(builder, EGL.as_ref().map(|w| &w.0)));
+ let window = try!(win32::Window::new(&WindowAttributes { visible: false, .. Default::default() },
+ pf_reqs, &opengl.clone().map_sharing(|_| unimplemented!()), //TODO:
+ EGL.as_ref().map(|w| &w.0)));
Ok(HeadlessContext::HiddenWindow(window))
}
}