aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-12-05 11:54:56 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2016-02-09 14:25:21 +0100
commit982279bc39737af0ba8ee712b744cc3335b001b0 (patch)
treea0510c0191fd5dd72bafeaecdc9c17975aeac823 /src
parent03ca5d5216df371d4146717accb2cd609a76e6a8 (diff)
downloadglutin-982279bc39737af0ba8ee712b744cc3335b001b0.tar.gz
glutin-982279bc39737af0ba8ee712b744cc3335b001b0.zip
Update the emscripten port of glutin
Diffstat (limited to 'src')
-rw-r--r--src/api/caca/mod.rs2
-rw-r--r--src/api/emscripten/mod.rs39
-rw-r--r--src/api/osmesa/mod.rs2
-rw-r--r--src/lib.rs2
-rw-r--r--src/platform/emscripten/mod.rs11
-rw-r--r--src/platform/mod.rs5
6 files changed, 47 insertions, 14 deletions
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/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/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/lib.rs b/src/lib.rs
index 2bd7fe3..a27aa72 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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/platform/emscripten/mod.rs b/src/platform/emscripten/mod.rs
index 270cdaf..1a78dfb 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!()
}
}
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;