diff options
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/init.rs | 14 | ||||
-rw-r--r-- | src/win32/mod.rs | 5 | ||||
-rw-r--r-- | src/win32/monitor.rs | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/win32/init.rs b/src/win32/init.rs index 7b236b0..d3341fe 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -7,6 +7,7 @@ use CreationError::OsError; use std::cell::RefCell; use std::rc::Rc; +use std::sync::mpsc::{Sender, Receiver, channel}; use libc; use super::gl; @@ -222,11 +223,12 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin // loading the extra WGL functions let extra_functions = gl::wgl_extra::Wgl::load_with(|addr| { + use libc; + use std::c_str::ToCStr; + unsafe { - addr.with_c_str(|s| { - use libc; - gl::wgl::GetProcAddress(s) as *const libc::c_void - }) + let addr = addr.to_c_str(); + gl::wgl::GetProcAddress(addr.as_ptr()) as *const libc::c_void } }); @@ -417,7 +419,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin } }).detach(); - rx.recv() + rx.recv().unwrap() } /// Checks that the window is the good one, and if so send the event to it. @@ -435,7 +437,7 @@ fn send_event(input_window: winapi::HWND, event: Event) { return; } - sender.send_opt(event).ok(); // ignoring if closed + sender.send(event).ok(); // ignoring if closed }); } diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 75706f6..78e2265 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -1,6 +1,7 @@ use std::sync::atomic::AtomicBool; use std::ptr; use std::collections::RingBuf; +use std::sync::mpsc::Receiver; use libc; use {CreationError, Event}; @@ -89,7 +90,7 @@ impl Window { } } -#[deriving(Clone)] +#[derive(Clone)] pub struct WindowProxy; impl WindowProxy { @@ -222,7 +223,7 @@ impl Window { /// See the docs in the crate root file. // TODO: return iterator pub fn wait_events(&self) -> RingBuf<Event> { - match self.events_receiver.recv_opt() { + match self.events_receiver.recv() { Ok(ev) => { // if the received event is `Closed`, setting `is_closed` to true match ev { diff --git a/src/win32/monitor.rs b/src/win32/monitor.rs index 82ee02a..4aca57b 100644 --- a/src/win32/monitor.rs +++ b/src/win32/monitor.rs @@ -5,7 +5,7 @@ use std::collections::RingBuf; /// Win32 implementation of the main `MonitorID` object. pub struct MonitorID { /// The system name of the monitor. - name: [winapi::WCHAR, ..32], + name: [winapi::WCHAR; 32], /// Name to give to the user. readable_name: String, |