aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-01-03 23:11:59 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-01-03 23:15:39 +0100
commit4c5e430dd3fcd38c29bfbc20dc0cc65defd33224 (patch)
tree438ed8c0ce41fa513e92a4dd0696bf4114df38fa
parentebe32bb2d803bc22c4b309acbbd48f3dc2a12127 (diff)
downloadglutin-4c5e430dd3fcd38c29bfbc20dc0cc65defd33224.tar.gz
glutin-4c5e430dd3fcd38c29bfbc20dc0cc65defd33224.zip
Update for Rustc
-rw-r--r--Cargo.toml4
-rw-r--r--examples/fullscreen.rs2
-rw-r--r--examples/support/mod.rs2
-rw-r--r--src/android/mod.rs2
-rw-r--r--src/events.rs8
-rw-r--r--src/lib.rs6
-rw-r--r--src/osx/mod.rs2
-rw-r--r--src/win32/init.rs14
-rw-r--r--src/win32/mod.rs5
-rw-r--r--src/win32/monitor.rs2
-rw-r--r--src/x11/ffi.rs6
-rw-r--r--src/x11/window/mod.rs6
12 files changed, 32 insertions, 27 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6b7143c..42b06f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,9 +38,9 @@ git = "https://github.com/servo/rust-core-graphics"
git = "https://github.com/servo/rust-core-graphics"
[target.i686-pc-windows-gnu.dependencies.winapi]
-version = "^0.0.3"
+version = "*"
features = ["gdi32", "kernel32", "user32"]
[target.x86_64-pc-windows-gnu.dependencies.winapi]
-version = "^0.0.3"
+version = "*"
features = ["gdi32", "kernel32", "user32"]
diff --git a/examples/fullscreen.rs b/examples/fullscreen.rs
index bc15379..6a2af2c 100644
--- a/examples/fullscreen.rs
+++ b/examples/fullscreen.rs
@@ -25,7 +25,7 @@ fn main() {
}
print!("Please write the number of the monitor to use: ");
- let num = from_str(stdin().read_line().unwrap().as_slice().trim())
+ let num = stdin().read_line().unwrap().as_slice().trim().parse()
.expect("Plase enter a number");
let monitor = glutin::get_available_monitors().nth(num).expect("Please enter a valid ID");
diff --git a/examples/support/mod.rs b/examples/support/mod.rs
index 6904653..42ce6a4 100644
--- a/examples/support/mod.rs
+++ b/examples/support/mod.rs
@@ -80,7 +80,7 @@ impl Context {
}
#[cfg(target_os = "android")]
-static VERTEX_DATA: [f32, ..15] = [
+static VERTEX_DATA: [f32; 15] = [
-0.5, -0.5, 1.0, 0.0, 0.0,
0.0, 0.5, 0.0, 1.0, 0.0,
0.5, -0.5, 0.0, 0.0, 1.0
diff --git a/src/android/mod.rs b/src/android/mod.rs
index c548f2f..7df0bec 100644
--- a/src/android/mod.rs
+++ b/src/android/mod.rs
@@ -287,7 +287,7 @@ unsafe impl Send for Window {}
unsafe impl Sync for Window {}
#[cfg(feature = "window")]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct WindowProxy;
impl WindowProxy {
diff --git a/src/events.rs b/src/events.rs
index beafbec..8b993bb 100644
--- a/src/events.rs
+++ b/src/events.rs
@@ -1,4 +1,4 @@
-#[deriving(Clone, Show, Copy)]
+#[derive(Clone, Show, Copy)]
pub enum Event {
/// The size of the window has changed.
Resized(uint, uint),
@@ -38,13 +38,13 @@ pub enum Event {
pub type ScanCode = u8;
-#[deriving(Show, Hash, PartialEq, Eq, Clone, Copy)]
+#[derive(Show, Hash, PartialEq, Eq, Clone, Copy)]
pub enum ElementState {
Pressed,
Released,
}
-#[deriving(Show, Hash, PartialEq, Eq, Clone, Copy)]
+#[derive(Show, Hash, PartialEq, Eq, Clone, Copy)]
pub enum MouseButton {
LeftMouseButton,
RightMouseButton,
@@ -52,7 +52,7 @@ pub enum MouseButton {
OtherMouseButton(u8),
}
-#[deriving(Show, Hash, PartialEq, Eq, Clone, Copy)]
+#[derive(Show, Hash, PartialEq, Eq, Clone, Copy)]
pub enum VirtualKeyCode {
/// The '1' key over the letters.
Key1,
diff --git a/src/lib.rs b/src/lib.rs
index 3c780a0..49bd078 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -68,7 +68,7 @@ mod events;
pub struct MonitorID(winimpl::MonitorID);
/// Error that can happen while creating a window or a headless renderer.
-#[deriving(Clone, Show, PartialEq, Eq)]
+#[derive(Clone, Show, PartialEq, Eq)]
pub enum CreationError {
OsError(String),
NotSupported,
@@ -84,7 +84,7 @@ impl std::error::Error for CreationError {
}
/// All APIs related to OpenGL that you can possibly get while using glutin.
-#[deriving(Show, Clone, Copy, PartialEq, Eq)]
+#[derive(Show, Clone, Copy, PartialEq, Eq)]
pub enum Api {
/// The classical OpenGL. Available on Windows, Linux, OS/X.
OpenGl,
@@ -575,7 +575,7 @@ impl gl_common::GlFunctionsSource for Window {
/// threads.
///
#[cfg(feature = "window")]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct WindowProxy {
proxy: winimpl::WindowProxy,
}
diff --git a/src/osx/mod.rs b/src/osx/mod.rs
index 80e08da..8e8b194 100644
--- a/src/osx/mod.rs
+++ b/src/osx/mod.rs
@@ -78,7 +78,7 @@ unsafe impl Send for Window {}
unsafe impl Sync for Window {}
#[cfg(feature = "window")]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct WindowProxy;
impl WindowProxy {
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,
diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs
index 5610eee..0528720 100644
--- a/src/x11/ffi.rs
+++ b/src/x11/ffi.rs
@@ -1241,7 +1241,7 @@ pub struct XSetWindowAttributes {
#[repr(C)]
pub struct XEvent {
pub type_: libc::c_int,
- pad: [libc::c_long, ..24],
+ pad: [libc::c_long; 24],
}
#[repr(C)]
@@ -1253,7 +1253,7 @@ pub struct XClientMessageEvent {
pub window: Window,
pub message_type: Atom,
pub format: libc::c_int,
- pub l: [libc::c_long, ..5],
+ pub l: [libc::c_long; 5],
}
#[repr(C)]
@@ -1435,7 +1435,7 @@ extern "C" {
res_class: *mut libc::c_char) -> XIM;
// TODO: this is a vararg function
- //pub fn XCreateIC(im: XIM, ...) -> XIC;
+ //pub fn XCreateIC(im: XIM; .) -> XIC;
pub fn XCreateIC(im: XIM, a: *const libc::c_char, b: libc::c_long, c: *const libc::c_char,
d: Window, e: *const ()) -> XIC;
pub fn XDestroyIC(ic: XIC);
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 768d480..1309fd4 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -57,7 +57,7 @@ impl Drop for XWindow {
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct WindowProxy {
x: Arc<XWindow>,
}
@@ -302,6 +302,7 @@ impl Window {
// loading the extra GLX functions
let extra_functions = ffi::glx_extra::Glx::load_with(|addr| {
+ use std::c_str::ToCStr;
addr.with_c_str(|s| {
use libc;
ffi::glx::GetProcAddress(s as *const u8) as *const libc::c_void
@@ -355,6 +356,7 @@ impl Window {
}
pub fn set_title(&self, title: &str) {
+ use std::c_str::ToCStr;
let c_title = title.to_c_str();
unsafe {
ffi::XStoreName(self.x.display, self.x.window, c_title.as_ptr());
@@ -494,7 +496,7 @@ impl Window {
let written = unsafe {
use std::str;
- let mut buffer: [u8, ..16] = [mem::uninitialized(), ..16];
+ let mut buffer: [u8; 16] = [mem::uninitialized(); 16];
let raw_ev: *mut ffi::XKeyEvent = event;
let count = ffi::Xutf8LookupString(self.x.ic, mem::transmute(raw_ev),
mem::transmute(buffer.as_mut_ptr()),