aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/emscripten/mod.rs16
-rw-r--r--src/platform/ios/mod.rs9
-rw-r--r--src/platform/linux/api_dispatch.rs6
-rw-r--r--src/platform/linux/mod.rs8
-rw-r--r--src/platform/mod.rs5
-rw-r--r--src/platform/windows/mod.rs11
6 files changed, 46 insertions, 9 deletions
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