Update the emscripten port of glutin
This commit is contained in:
parent
03ca5d5216
commit
982279bc39
8 changed files with 49 additions and 19 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
@ -72,6 +79,11 @@ impl MonitorId {
|
|||
Some("Canvas".to_owned())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_native_identifier(&self) -> ::native_monitor::NativeMonitorId {
|
||||
::native_monitor::NativeMonitorId::Unavailable
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_dimensions(&self) -> (u32, u32) {
|
||||
unimplemented!()
|
||||
|
|
@ -79,7 +91,9 @@ impl MonitorId {
|
|||
}
|
||||
|
||||
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 _
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue