diff options
-rw-r--r-- | src/lib.rs | 6 | ||||
-rw-r--r-- | src/x11/ffi.rs | 1 | ||||
-rw-r--r-- | src/x11/window/mod.rs | 6 |
3 files changed, 7 insertions, 6 deletions
@@ -46,10 +46,10 @@ extern crate cocoa; extern crate core_foundation; #[cfg(target_os = "macos")] extern crate glutin_core_graphics as core_graphics; -#[cfg(target_os = "linux")] -extern crate osmesa_sys; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "freebsd"))] extern crate x11; +#[cfg(all(any(target_os = "linux", target_os = "freebsd"), feature="headless"))] +extern crate osmesa_sys; pub use events::*; #[cfg(feature = "headless")] diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs index 8acf681..2fcda3b 100644 --- a/src/x11/ffi.rs +++ b/src/x11/ffi.rs @@ -1,3 +1,4 @@ +#[cfg(feature="headless")] pub use osmesa_sys::*; pub use x11::keysym::*; pub use x11::xcursor::*; diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs index 5527b9e..270746f 100644 --- a/src/x11/window/mod.rs +++ b/src/x11/window/mod.rs @@ -90,7 +90,7 @@ pub struct WindowProxy { impl WindowProxy { pub fn wakeup_event_loop(&self) { let mut xev = ffi::XClientMessageEvent { - _type: ffi::ClientMessage, + type_: ffi::ClientMessage, window: self.x.window, format: 32, message_type: 0, @@ -171,7 +171,7 @@ impl<'a> Iterator for PollEventsIterator<'a> { use events::ElementState::{Pressed, Released}; let event: &mut ffi::XKeyEvent = unsafe { mem::transmute(&xev) }; - if event._type == ffi::KeyPress { + if event.type_ == ffi::KeyPress { let raw_ev: *mut ffi::XKeyEvent = event; unsafe { ffi::XFilterEvent(mem::transmute(raw_ev), self.window.x.window) }; } @@ -335,7 +335,7 @@ impl Window { return Err(OsError(format!("glx::ChooseFBConfig failed"))); } let preferred_fb = *fb; // TODO: choose more wisely - ffi::XFree(fb as *mut ()); + ffi::XFree(fb as *mut _); preferred_fb }; |