From 8f3ec7998de74dfdb69bd1ef7f038767313b3ae1 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 21 Sep 2015 11:11:11 +0200 Subject: [PATCH] Finish converting windows to the new design --- src/api/win32/mod.rs | 12 +++++++++--- src/platform/windows/mod.rs | 6 ++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/api/win32/mod.rs b/src/api/win32/mod.rs index 7d7de058..eb31873f 100644 --- a/src/api/win32/mod.rs +++ b/src/api/win32/mod.rs @@ -13,11 +13,14 @@ use libc; use ContextError; use {CreationError, Event, MouseCursor}; use CursorState; +use GlAttributes; use GlContext; use Api; use PixelFormat; +use PixelFormatRequirements; use BuilderAttribs; +use WindowAttributes; pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor}; @@ -83,15 +86,18 @@ impl WindowProxy { impl Window { /// See the docs in the crate root file. - pub fn new(builder: BuilderAttribs, egl: Option<&Egl>) -> Result { - let opengl = builder.opengl.clone().map_sharing(|sharing| { + pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements, + opengl: &GlAttributes<&Window>, egl: Option<&Egl>) + -> Result + { + let opengl = opengl.clone().map_sharing(|sharing| { match sharing.context { Context::Wgl(ref c) => RawContext::Wgl(c.get_hglrc()), Context::Egl(_) => unimplemented!(), // FIXME: } }); - init::new_window(&builder.window, &builder.pf_reqs, &opengl, egl) + init::new_window(window, pf_reqs, &opengl, egl) } /// See the docs in the crate root file. diff --git a/src/platform/windows/mod.rs b/src/platform/windows/mod.rs index 918b779e..51f75676 100644 --- a/src/platform/windows/mod.rs +++ b/src/platform/windows/mod.rs @@ -58,7 +58,8 @@ pub struct Window(win32::Window); impl Window { /// See the docs in the crate root file. pub fn new(builder: BuilderAttribs) -> Result { - win32::Window::new(builder, EGL.as_ref().map(|w| &w.0)).map(|w| Window(w)) + win32::Window::new(&builder.window, &builder.pf_reqs, &builder.opengl.clone().map_sharing(|w| &w.0), + EGL.as_ref().map(|w| &w.0)).map(|w| Window(w)) } } @@ -101,7 +102,8 @@ impl HeadlessContext { } } - let window = try!(win32::Window::new(builder, EGL.as_ref().map(|w| &w.0))); + let window = try!(win32::Window::new(&builder.window, &builder.pf_reqs, &builder.opengl.clone().map_sharing(|w| &w.0), + EGL.as_ref().map(|w| &w.0))); Ok(HeadlessContext::HiddenWindow(window)) } }