Merge pull request #137 from glennw/android-headless-compile

Allows android to compile when headless feature is enabled.
This commit is contained in:
David Partouche 2014-11-25 23:55:09 +01:00
commit ef33f19812

View file

@ -7,6 +7,9 @@ use events::ElementState::{Pressed, Released};
use events::Event::{MouseInput, MouseMoved}; use events::Event::{MouseInput, MouseMoved};
use events::MouseButton::LeftMouseButton; use events::MouseButton::LeftMouseButton;
#[cfg(feature = "headless")]
use HeadlessRendererBuilder;
pub struct Window { pub struct Window {
display: ffi::egl::types::EGLDisplay, display: ffi::egl::types::EGLDisplay,
context: ffi::egl::types::EGLContext, context: ffi::egl::types::EGLContext,
@ -38,6 +41,27 @@ impl MonitorID {
} }
} }
#[cfg(feature = "headless")]
pub struct HeadlessContext(int);
#[cfg(feature = "headless")]
impl HeadlessContext {
/// See the docs in the crate root file.
pub fn new(builder: HeadlessRendererBuilder) -> Result<HeadlessContext, CreationError> {
unimplemented!()
}
/// See the docs in the crate root file.
pub unsafe fn make_current(&self) {
unimplemented!()
}
/// See the docs in the crate root file.
pub fn get_proc_address(&self, addr: &str) -> *const () {
unimplemented!()
}
}
impl Window { impl Window {
pub fn new(builder: WindowBuilder) -> Result<Window, CreationError> { pub fn new(builder: WindowBuilder) -> Result<Window, CreationError> {
use std::{mem, ptr}; use std::{mem, ptr};
@ -116,7 +140,7 @@ impl Window {
} }
surface surface
}; };
android_glue::write_log("eglCreateWindowSurface succeeded"); android_glue::write_log("eglCreateWindowSurface succeeded");
let (tx, rx) = channel(); let (tx, rx) = channel();
@ -196,8 +220,8 @@ impl Window {
}, },
}, },
Err(_) => { Err(_) => {
break; break;
}, },
} }
} }
events events