mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Finish converting windows to the new design
This commit is contained in:
parent
932e565391
commit
8f3ec7998d
|
@ -13,11 +13,14 @@ use libc;
|
||||||
use ContextError;
|
use ContextError;
|
||||||
use {CreationError, Event, MouseCursor};
|
use {CreationError, Event, MouseCursor};
|
||||||
use CursorState;
|
use CursorState;
|
||||||
|
use GlAttributes;
|
||||||
use GlContext;
|
use GlContext;
|
||||||
|
|
||||||
use Api;
|
use Api;
|
||||||
use PixelFormat;
|
use PixelFormat;
|
||||||
|
use PixelFormatRequirements;
|
||||||
use BuilderAttribs;
|
use BuilderAttribs;
|
||||||
|
use WindowAttributes;
|
||||||
|
|
||||||
pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor};
|
pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor};
|
||||||
|
|
||||||
|
@ -83,15 +86,18 @@ impl WindowProxy {
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
/// See the docs in the crate root file.
|
/// See the docs in the crate root file.
|
||||||
pub fn new(builder: BuilderAttribs, egl: Option<&Egl>) -> Result<Window, CreationError> {
|
pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements,
|
||||||
let opengl = builder.opengl.clone().map_sharing(|sharing| {
|
opengl: &GlAttributes<&Window>, egl: Option<&Egl>)
|
||||||
|
-> Result<Window, CreationError>
|
||||||
|
{
|
||||||
|
let opengl = opengl.clone().map_sharing(|sharing| {
|
||||||
match sharing.context {
|
match sharing.context {
|
||||||
Context::Wgl(ref c) => RawContext::Wgl(c.get_hglrc()),
|
Context::Wgl(ref c) => RawContext::Wgl(c.get_hglrc()),
|
||||||
Context::Egl(_) => unimplemented!(), // FIXME:
|
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.
|
/// See the docs in the crate root file.
|
||||||
|
|
|
@ -58,7 +58,8 @@ pub struct Window(win32::Window);
|
||||||
impl Window {
|
impl Window {
|
||||||
/// See the docs in the crate root file.
|
/// See the docs in the crate root file.
|
||||||
pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> {
|
pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> {
|
||||||
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))
|
Ok(HeadlessContext::HiddenWindow(window))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue