From c9194e922e3a60e8511cba8f50472f1f3457ddad Mon Sep 17 00:00:00 2001 From: Daggerbot Date: Sat, 11 Apr 2015 18:17:49 -0700 Subject: Fixes for x11-rs/osmesa-sys conversion. --- src/lib.rs | 6 +++--- src/x11/ffi.rs | 1 + src/x11/window/mod.rs | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9173735..9ed059e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 }; -- cgit v1.2.3