aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/emscripten
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2016-02-09 14:40:21 +0100
committertomaka <pierre.krieger1708@gmail.com>2016-02-09 14:40:21 +0100
commit75a940d4f1240fff9adeed9b0ff869e9aa0f5814 (patch)
treea0510c0191fd5dd72bafeaecdc9c17975aeac823 /src/api/emscripten
parent03ca5d5216df371d4146717accb2cd609a76e6a8 (diff)
parent982279bc39737af0ba8ee712b744cc3335b001b0 (diff)
downloadglutin-75a940d4f1240fff9adeed9b0ff869e9aa0f5814.tar.gz
glutin-75a940d4f1240fff9adeed9b0ff869e9aa0f5814.zip
Merge pull request #668 from tomaka/emscripten
Update the emscripten port of glutin
Diffstat (limited to 'src/api/emscripten')
-rw-r--r--src/api/emscripten/mod.rs39
1 files changed, 31 insertions, 8 deletions
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 _
}
}