Update for Rustc

This commit is contained in:
Pierre Krieger 2015-01-03 23:11:59 +01:00
parent ebe32bb2d8
commit 4c5e430dd3
12 changed files with 32 additions and 27 deletions

View file

@ -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
});
}

View file

@ -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 {

View file

@ -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,