diff options
-rw-r--r-- | Cargo.toml | 14 | ||||
-rw-r--r-- | examples/support/mod.rs | 4 | ||||
-rw-r--r-- | src/api/android/mod.rs | 12 | ||||
-rw-r--r-- | src/api/caca/mod.rs | 2 | ||||
-rw-r--r-- | src/api/cocoa/headless.rs | 7 | ||||
-rw-r--r-- | src/api/cocoa/mod.rs | 21 | ||||
-rw-r--r-- | src/api/emscripten/mod.rs | 39 | ||||
-rw-r--r-- | src/api/ios/mod.rs | 6 | ||||
-rw-r--r-- | src/api/osmesa/mod.rs | 2 | ||||
-rw-r--r-- | src/api/x11/window.rs | 27 | ||||
-rw-r--r-- | src/headless.rs | 7 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/os/unix.rs | 11 | ||||
-rw-r--r-- | src/os/windows.rs | 11 | ||||
-rw-r--r-- | src/platform/emscripten/mod.rs | 16 | ||||
-rw-r--r-- | src/platform/ios/mod.rs | 9 | ||||
-rw-r--r-- | src/platform/linux/api_dispatch.rs | 6 | ||||
-rw-r--r-- | src/platform/linux/mod.rs | 8 | ||||
-rw-r--r-- | src/platform/mod.rs | 5 | ||||
-rw-r--r-- | src/platform/windows/mod.rs | 11 | ||||
-rw-r--r-- | src/window.rs | 6 |
21 files changed, 176 insertions, 50 deletions
@@ -1,7 +1,7 @@ [package] name = "glutin" -version = "0.4.6" -authors = ["tomaka <pierre.krieger1708@gmail.com>"] +version = "0.4.8" +authors = ["The glutin contributors, Pierre Krieger <pierre.krieger1708@gmail.com>"] description = "Cross-platform OpenGL context provider." keywords = ["windowing", "opengl"] license = "Apache-2.0" @@ -19,9 +19,6 @@ shared_library = "0.1.0" gl_generator = "0.4" khronos_api = "1.0" -[dev-dependencies] -clock_ticks = "0.1.0" - [target.arm-linux-androideabi.dependencies.android_glue] version = "0.1" @@ -107,6 +104,13 @@ wayland-kbd = "0.3.3" wayland-window = "0.2.2" x11-dl = "~2.3" +[target.armv7-unknown-linux-gnueabihf.dependencies] +osmesa-sys = "0.0.5" +wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } +wayland-kbd = "0.3.3" +wayland-window = "0.2.2" +x11-dl = "~2.3" + [target.aarch64-unknown-linux-gnu.dependencies] osmesa-sys = "0.0.5" wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] } diff --git a/examples/support/mod.rs b/examples/support/mod.rs index ebbe379..a51ca24 100644 --- a/examples/support/mod.rs +++ b/examples/support/mod.rs @@ -24,11 +24,11 @@ pub fn load(window: &glutin::Window) -> Context { unsafe { let vs = gl.CreateShader(gl::VERTEX_SHADER); - gl.ShaderSource(vs, 1, [VS_SRC.as_ptr() as *const i8].as_ptr(), ptr::null()); + gl.ShaderSource(vs, 1, [VS_SRC.as_ptr() as *const _].as_ptr(), ptr::null()); gl.CompileShader(vs); let fs = gl.CreateShader(gl::FRAGMENT_SHADER); - gl.ShaderSource(fs, 1, [FS_SRC.as_ptr() as *const i8].as_ptr(), ptr::null()); + gl.ShaderSource(fs, 1, [FS_SRC.as_ptr() as *const _].as_ptr(), ptr::null()); gl.CompileShader(fs); let program = gl.CreateProgram(); diff --git a/src/api/android/mod.rs b/src/api/android/mod.rs index f42caeb..433472c 100644 --- a/src/api/android/mod.rs +++ b/src/api/android/mod.rs @@ -65,6 +65,11 @@ impl MonitorId { } } +#[derive(Default)] +pub struct PlatformSpecificWindowBuilderAttributes; +#[derive(Default)] +pub struct PlatformSpecificHeadlessBuilderAttributes; + pub struct PollEventsIterator<'a> { window: &'a Window, } @@ -116,7 +121,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> { impl Window { pub fn new(win_attribs: &WindowAttributes, pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&Window>) -> Result<Window, CreationError> + opengl: &GlAttributes<&Window>, _: &PlatformSpecificWindowBuilderAttributes) + -> Result<Window, CreationError> { use std::{mem, ptr}; @@ -302,7 +308,9 @@ pub struct HeadlessContext(EglContext); impl HeadlessContext { /// See the docs in the crate root file. pub fn new(dimensions: (u32, u32), pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> + opengl: &GlAttributes<&HeadlessContext>, + _: &PlatformSpecificHeadlessBuilderAttributes) + -> Result<HeadlessContext, CreationError> { let opengl = opengl.clone().map_sharing(|c| &c.0); let context = try!(EglContext::new(egl::ffi::egl::Egl, pf_reqs, &opengl, diff --git a/src/api/caca/mod.rs b/src/api/caca/mod.rs index 687c66f..e73fa6c 100644 --- a/src/api/caca/mod.rs +++ b/src/api/caca/mod.rs @@ -1,4 +1,4 @@ -#![cfg(any(target_os = "linux", target_os = "freebsd"))] +#![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))] #![allow(unused_variables, dead_code)] use libc; diff --git a/src/api/cocoa/headless.rs b/src/api/cocoa/headless.rs index 7fe2046..ac6c4e0 100644 --- a/src/api/cocoa/headless.rs +++ b/src/api/cocoa/headless.rs @@ -13,6 +13,9 @@ use cocoa::appkit::*; use PixelFormat; use api::cocoa::helpers; +#[derive(Default)] +pub struct PlatformSpecificHeadlessBuilderAttributes; + pub struct HeadlessContext { width: u32, height: u32, @@ -21,7 +24,9 @@ pub struct HeadlessContext { impl HeadlessContext { pub fn new((width, height): (u32, u32), pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> + opengl: &GlAttributes<&HeadlessContext>, + _: &PlatformSpecificHeadlessBuilderAttributes) + -> Result<HeadlessContext, CreationError> { let context = unsafe { diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 138a448..4502405 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -1,7 +1,5 @@ #![cfg(target_os = "macos")] -pub use self::headless::HeadlessContext; - use {CreationError, Event, MouseCursor, CursorState}; use CreationError::OsError; use libc; @@ -50,6 +48,8 @@ use events::MouseButton; use events; pub use self::monitor::{MonitorId, get_available_monitors, get_primary_monitor}; +pub use self::headless::HeadlessContext; +pub use self::headless::PlatformSpecificHeadlessBuilderAttributes; mod monitor; mod event; @@ -179,6 +179,9 @@ impl Drop for WindowDelegate { } } +#[derive(Default)] +pub struct PlatformSpecificWindowBuilderAttributes; + pub struct Window { view: IdRef, window: IdRef, @@ -264,7 +267,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> { impl Window { pub fn new(win_attribs: &WindowAttributes, pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&Window>) -> Result<Window, CreationError> + opengl: &GlAttributes<&Window>, _: &PlatformSpecificWindowBuilderAttributes) + -> Result<Window, CreationError> { if opengl.sharing.is_some() { unimplemented!() @@ -837,9 +841,7 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> { let received_c_str = nsevent.characters().UTF8String(); let received_str = CStr::from_ptr(received_c_str); for received_char in from_utf8(received_str.to_bytes()).unwrap().chars() { - if received_char.is_ascii() { - events.push_back(ReceivedCharacter(received_char)); - } + events.push_back(ReceivedCharacter(received_char)); } let vkey = event::vkeycode_to_element(NSEvent::keyCode(nsevent)); @@ -881,10 +883,13 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> { }, NSScrollWheel => { use events::MouseScrollDelta::{LineDelta, PixelDelta}; + let scale_factor = window.hidpi_factor(); let delta = if nsevent.hasPreciseScrollingDeltas() == YES { - PixelDelta(nsevent.scrollingDeltaX() as f32, nsevent.scrollingDeltaY() as f32) + PixelDelta(scale_factor * nsevent.scrollingDeltaX() as f32, + scale_factor * nsevent.scrollingDeltaY() as f32) } else { - LineDelta(nsevent.scrollingDeltaX() as f32, nsevent.scrollingDeltaY() as f32) + LineDelta(scale_factor * nsevent.scrollingDeltaX() as f32, + scale_factor * nsevent.scrollingDeltaY() as f32) }; Some(MouseWheel(delta)) }, diff --git a/src/api/emscripten/mod.rs b/src/api/emscripten/mod.rs index 61d8c8c..67f57d1 100644 --- a/src/api/emscripten/mod.rs +++ b/src/api/emscripten/mod.rs @@ -2,11 +2,17 @@ use std::ffi::CString; use libc; -use {Event, BuilderAttribs, CreationError, MouseCursor}; use Api; -use PixelFormat; +use Event; +use CreationError; use ContextError; +use CursorState; +use GlAttributes; use GlContext; +use MouseCursor; +use PixelFormat; +use PixelFormatRequirements; +use WindowAttributes; use std::collections::VecDeque; @@ -52,6 +58,7 @@ impl WindowProxy { } } +#[derive(Clone)] pub struct MonitorId; #[inline] @@ -73,13 +80,20 @@ impl MonitorId { } #[inline] + pub fn get_native_identifier(&self) -> ::native_monitor::NativeMonitorId { + ::native_monitor::NativeMonitorId::Unavailable + } + + #[inline] pub fn get_dimensions(&self) -> (u32, u32) { unimplemented!() } } impl Window { - pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> { + pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements, + opengl: &GlAttributes<&Window>) -> Result<Window, CreationError> + { // getting the default values of attributes let mut attributes = unsafe { use std::mem; @@ -198,14 +212,23 @@ impl Window { } #[inline] - pub fn set_cursor(&self, _cursor: MouseCursor) { - unimplemented!() + pub fn set_cursor(&self, cursor: MouseCursor) { + } + + #[inline] + pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> { + Ok(()) } #[inline] pub fn hidpi_factor(&self) -> f32 { 1.0 } + + #[inline] + pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> { + Ok(()) + } } impl GlContext for Window { @@ -222,11 +245,11 @@ impl GlContext for Window { } fn get_proc_address(&self, addr: &str) -> *const () { - let addr = CString::new(addr.as_bytes()).unwrap(); - let addr = addr.as_ptr(); + let addr = CString::new(addr).unwrap(); unsafe { - ffi::emscripten_GetProcAddress(addr) as *const _ + // FIXME: if `as_ptr()` is used, then wrong data is passed to emscripten + ffi::emscripten_GetProcAddress(addr.into_raw() as *const _) as *const _ } } diff --git a/src/api/ios/mod.rs b/src/api/ios/mod.rs index 852d97c..afcc6f4 100644 --- a/src/api/ios/mod.rs +++ b/src/api/ios/mod.rs @@ -177,10 +177,14 @@ impl MonitorId { } } +#[derive(Default)] +pub struct PlatformSpecificWindowBuilderAttributes; impl Window { - pub fn new(builder: &WindowAttributes, _: &PixelFormatRequirements, _: &GlAttributes<&Window>) -> Result<Window, CreationError> { + pub fn new(builder: &WindowAttributes, _: &PixelFormatRequirements, _: &GlAttributes<&Window>, + _: &PlatformSpecificWindowBuilderAttributes) -> Result<Window, CreationError> + { unsafe { if setjmp(mem::transmute(&mut jmpbuf)) != 0 { let app: id = msg_send![Class::get("UIApplication").unwrap(), sharedApplication]; diff --git a/src/api/osmesa/mod.rs b/src/api/osmesa/mod.rs index 02c43a1..7ef243a 100644 --- a/src/api/osmesa/mod.rs +++ b/src/api/osmesa/mod.rs @@ -1,4 +1,4 @@ -#![cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))] +#![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))] extern crate osmesa_sys; diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs index 4b78c4a..8cae2be 100644 --- a/src/api/x11/window.rs +++ b/src/api/x11/window.rs @@ -469,10 +469,6 @@ impl Window { display.check_errors().expect("Failed to call XInternAtom"); (display.xlib.XSetWMProtocols)(display.display, window, &mut wm_delete_window, 1); display.check_errors().expect("Failed to call XSetWMProtocols"); - with_c_str(&*window_attrs.title, |title| {; - (display.xlib.XStoreName)(display.display, window, title); - }); - display.check_errors().expect("Failed to call XStoreName"); (display.xlib.XFlush)(display.display); display.check_errors().expect("Failed to call XFlush"); @@ -636,6 +632,8 @@ impl Window { input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs)) }; + window.set_title(&window_attrs.title); + if window_attrs.visible { unsafe { let ref x_window: &XWindow = window.x.borrow(); @@ -669,12 +667,27 @@ impl Window { } pub fn set_title(&self, title: &str) { - with_c_str(title, |title| unsafe { - (self.x.display.xlib.XStoreName)(self.x.display.display, self.x.window, title); + let wm_name = unsafe { + (self.x.display.xlib.XInternAtom)(self.x.display.display, b"_NET_WM_NAME\0".as_ptr() as *const _, 0) + }; + self.x.display.check_errors().expect("Failed to call XInternAtom"); + + let wm_utf8_string = unsafe { + (self.x.display.xlib.XInternAtom)(self.x.display.display, b"UTF8_STRING\0".as_ptr() as *const _, 0) + }; + self.x.display.check_errors().expect("Failed to call XInternAtom"); + + with_c_str(title, |c_title| unsafe { + (self.x.display.xlib.XStoreName)(self.x.display.display, self.x.window, c_title); + + let len = title.as_bytes().len(); + (self.x.display.xlib.XChangeProperty)(self.x.display.display, self.x.window, + wm_name, wm_utf8_string, 8, ffi::PropModeReplace, + c_title as *const u8, len as libc::c_int); (self.x.display.xlib.XFlush)(self.x.display.display); }); + self.x.display.check_errors().expect("Failed to set window title"); - self.x.display.check_errors().expect("Failed to call XStoreName"); } pub fn show(&self) { diff --git a/src/headless.rs b/src/headless.rs index 67ea8da..8ea4141 100644 --- a/src/headless.rs +++ b/src/headless.rs @@ -20,6 +20,9 @@ pub struct HeadlessRendererBuilder<'a> { // Should be made public once it's stabilized. pf_reqs: PixelFormatRequirements, + + /// Platform-specific configuration. + platform_specific: platform::PlatformSpecificHeadlessBuilderAttributes, } impl<'a> HeadlessRendererBuilder<'a> { @@ -30,6 +33,7 @@ impl<'a> HeadlessRendererBuilder<'a> { dimensions: (width, height), pf_reqs: Default::default(), opengl: Default::default(), + platform_specific: Default::default(), } } @@ -63,7 +67,8 @@ impl<'a> HeadlessRendererBuilder<'a> { /// out of memory, etc. #[inline] pub fn build(self) -> Result<HeadlessContext, CreationError> { - platform::HeadlessContext::new(self.dimensions, &self.pf_reqs, &self.opengl) + platform::HeadlessContext::new(self.dimensions, &self.pf_reqs, &self.opengl, + &self.platform_specific) .map(|w| HeadlessContext { context: w }) } @@ -54,7 +54,7 @@ extern crate cocoa; extern crate core_foundation; #[cfg(target_os = "macos")] extern crate core_graphics; -#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))] +#[cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))] extern crate x11_dl; #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))] #[macro_use(wayland_env)] diff --git a/src/os/unix.rs b/src/os/unix.rs index d206351..f42b3c6 100644 --- a/src/os/unix.rs +++ b/src/os/unix.rs @@ -3,8 +3,9 @@ use libc; use Window; use platform::Window as LinuxWindow; +use WindowBuilder; -/// Additional methods on `Window` that are specific to unix. +/// Additional methods on `Window` that are specific to Unix. pub trait WindowExt { /// Returns a pointer to the `Window` object of xlib that is used by this window. /// @@ -38,3 +39,11 @@ impl WindowExt for Window { } } } + +/// Additional methods on `WindowBuilder` that are specific to Unix. +pub trait WindowBuilderExt { + +} + +impl<'a> WindowBuilderExt for WindowBuilder<'a> { +} diff --git a/src/os/windows.rs b/src/os/windows.rs index e9ab056..02a76e2 100644 --- a/src/os/windows.rs +++ b/src/os/windows.rs @@ -2,8 +2,9 @@ use libc; use Window; +use WindowBuilder; -/// Additional methods on `Window` that are specific to unix. +/// Additional methods on `Window` that are specific to Windows. pub trait WindowExt { /// Returns a pointer to the `Window` object of xlib that is used by this window. /// @@ -19,3 +20,11 @@ impl WindowExt for Window { self.window.platform_window() } } + +/// Additional methods on `WindowBuilder` that are specific to Windows. +pub trait WindowBuilderExt { + +} + +impl<'a> WindowBuilderExt for WindowBuilder<'a> { +} diff --git a/src/platform/emscripten/mod.rs b/src/platform/emscripten/mod.rs index 270cdaf..ce8d201 100644 --- a/src/platform/emscripten/mod.rs +++ b/src/platform/emscripten/mod.rs @@ -1,7 +1,12 @@ #![cfg(target_os = "emscripten")] +use Api; use ContextError; +use CreationError; +use GlAttributes; use GlContext; +use PixelFormat; +use PixelFormatRequirements; pub use api::emscripten::{Window, WindowProxy, MonitorId, get_available_monitors}; pub use api::emscripten::{get_primary_monitor, WaitEventsIterator, PollEventsIterator}; @@ -11,8 +16,10 @@ pub struct HeadlessContext(Window); impl HeadlessContext { /// See the docs in the crate root file. #[inline] - pub fn new(builder: BuilderAttribs) -> Result<HeadlessContext, CreationError> { - Window::new(builder).map(|w| HeadlessContext(w)) + pub fn new(_: (u32, u32), _: &PixelFormatRequirements, _: &GlAttributes<&HeadlessContext>) + -> Result<HeadlessContext, CreationError> + { + unimplemented!() } } @@ -50,3 +57,8 @@ impl GlContext for HeadlessContext { unsafe impl Send for HeadlessContext {} unsafe impl Sync for HeadlessContext {} + +#[derive(Default)] +pub struct PlatformSpecificWindowBuilderAttributes; +#[derive(Default)] +pub struct PlatformSpecificHeadlessBuilderAttributes; diff --git a/src/platform/ios/mod.rs b/src/platform/ios/mod.rs index aeaebc3..2e6fbec 100644 --- a/src/platform/ios/mod.rs +++ b/src/platform/ios/mod.rs @@ -8,12 +8,17 @@ use ContextError; pub use api::ios::*; +#[derive(Default)] +pub struct PlatformSpecificHeadlessBuilderAttributes; + pub struct HeadlessContext(i32); impl HeadlessContext { /// See the docs in the crate root file. - pub fn new(_: (u32, u32), _: &PixelFormatRequirements, _: &GlAttributes<&HeadlessContext>) - -> Result<HeadlessContext, CreationError> { + pub fn new(_: (u32, u32), _: &PixelFormatRequirements, _: &GlAttributes<&HeadlessContext>, + _: &PlatformSpecificHeadlessBuilderAttributes) + -> Result<HeadlessContext, CreationError> + { unimplemented!() } diff --git a/src/platform/linux/api_dispatch.rs b/src/platform/linux/api_dispatch.rs index 2373770..2e135e2 100644 --- a/src/platform/linux/api_dispatch.rs +++ b/src/platform/linux/api_dispatch.rs @@ -22,6 +22,9 @@ use api::x11::XConnection; use api::x11::XError; use api::x11::XNotSupported; +#[derive(Default)] +pub struct PlatformSpecificWindowBuilderAttributes; + enum Backend { X(Arc<XConnection>), Wayland, @@ -172,7 +175,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> { impl Window { #[inline] pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&Window>) -> Result<Window, CreationError> + opengl: &GlAttributes<&Window>, _: &PlatformSpecificWindowBuilderAttributes) + -> Result<Window, CreationError> { match *BACKEND { Backend::Wayland => { diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs index d010a89..9a9eb3f 100644 --- a/src/platform/linux/mod.rs +++ b/src/platform/linux/mod.rs @@ -12,13 +12,19 @@ use api::osmesa::{self, OsMesaContext}; pub use self::api_dispatch::{Window, WindowProxy, MonitorId, get_available_monitors, get_primary_monitor}; pub use self::api_dispatch::{WaitEventsIterator, PollEventsIterator}; +pub use self::api_dispatch::PlatformSpecificWindowBuilderAttributes; mod api_dispatch; +#[derive(Default)] +pub struct PlatformSpecificHeadlessBuilderAttributes; + pub struct HeadlessContext(OsMesaContext); impl HeadlessContext { pub fn new(dimensions: (u32, u32), pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> + opengl: &GlAttributes<&HeadlessContext>, + _: &PlatformSpecificHeadlessBuilderAttributes) + -> Result<HeadlessContext, CreationError> { let opengl = opengl.clone().map_sharing(|c| &c.0); diff --git a/src/platform/mod.rs b/src/platform/mod.rs index 4855765..8527da2 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -15,8 +15,11 @@ mod platform; #[cfg(target_os = "ios")] #[path="ios/mod.rs"] mod platform; +#[cfg(target_os = "emscripten")] +#[path="emscripten/mod.rs"] +mod platform; #[cfg(all(not(target_os = "ios"), not(target_os = "windows"), not(target_os = "linux"), not(target_os = "macos"), not(target_os = "android"), not(target_os = "dragonfly"), - not(target_os = "freebsd")))] + not(target_os = "freebsd"), not(target_os = "emscripten")))] use this_platform_is_not_supported; diff --git a/src/platform/windows/mod.rs b/src/platform/windows/mod.rs index 246ca51..0c78322 100644 --- a/src/platform/windows/mod.rs +++ b/src/platform/windows/mod.rs @@ -51,6 +51,10 @@ lazy_static! { }; } +#[derive(Default)] +pub struct PlatformSpecificWindowBuilderAttributes; +#[derive(Default)] +pub struct PlatformSpecificHeadlessBuilderAttributes; /// The Win32 implementation of the main `Window` object. pub struct Window(win32::Window); @@ -59,7 +63,8 @@ impl Window { /// See the docs in the crate root file. #[inline] pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&Window>) -> Result<Window, CreationError> + opengl: &GlAttributes<&Window>, _: &PlatformSpecificWindowBuilderAttributes) + -> 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)) @@ -92,7 +97,9 @@ pub enum HeadlessContext { impl HeadlessContext { pub fn new(dimensions: (u32, u32), pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> + opengl: &GlAttributes<&HeadlessContext>, + _: &PlatformSpecificHeadlessBuilderAttributes) + -> Result<HeadlessContext, CreationError> { // if EGL is available, we try using EGL first // if EGL returns an error, we try the hidden window method diff --git a/src/window.rs b/src/window.rs index f672ed5..6d2f0d3 100644 --- a/src/window.rs +++ b/src/window.rs @@ -31,6 +31,9 @@ pub struct WindowBuilder<'a> { // Should be made public once it's stabilized. pf_reqs: PixelFormatRequirements, + + /// Platform-specific configuration. + platform_specific: platform::PlatformSpecificWindowBuilderAttributes, } impl<'a> WindowBuilder<'a> { @@ -41,6 +44,7 @@ impl<'a> WindowBuilder<'a> { pf_reqs: Default::default(), window: Default::default(), opengl: Default::default(), + platform_specific: Default::default(), } } @@ -227,7 +231,7 @@ impl<'a> WindowBuilder<'a> { } // building - platform::Window::new(&self.window, &self.pf_reqs, &self.opengl) + platform::Window::new(&self.window, &self.pf_reqs, &self.opengl, &self.platform_specific) .map(|w| Window { window: w }) } |