aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2014-12-23 17:12:29 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2014-12-23 17:12:29 +0100
commitdbb82968baf17acdc341303813ecbbd8420de19c (patch)
treeba6094cbabbc260a3e16ea3e9d1c7a23f103fcf9
parent5a8982377b13379edef913805b488afb60424045 (diff)
downloadglutin-dbb82968baf17acdc341303813ecbbd8420de19c.tar.gz
glutin-dbb82968baf17acdc341303813ecbbd8420de19c.zip
Update for rustc
-rw-r--r--examples/multiwindow.rs12
-rw-r--r--examples/window.rs2
-rw-r--r--src/win32/init.rs20
3 files changed, 20 insertions, 14 deletions
diff --git a/examples/multiwindow.rs b/examples/multiwindow.rs
index 5fe9b71..1f390cd 100644
--- a/examples/multiwindow.rs
+++ b/examples/multiwindow.rs
@@ -6,6 +6,8 @@ extern crate android_glue;
extern crate glutin;
+use std::thread::Thread;
+
mod support;
#[cfg(target_os = "android")]
@@ -20,17 +22,21 @@ fn main() {
let window2 = glutin::Window::new().unwrap();
let window3 = glutin::Window::new().unwrap();
- spawn(move || {
+ let t1 = Thread::spawn(move || {
run(window1, (0.0, 1.0, 0.0, 1.0));
});
- spawn(move || {
+ let t2 = Thread::spawn(move || {
run(window2, (0.0, 0.0, 1.0, 1.0));
});
- spawn(move || {
+ let t3 = Thread::spawn(move || {
run(window3, (1.0, 0.0, 0.0, 1.0));
});
+
+ t1.join();
+ t2.join();
+ t3.join();
}
#[cfg(feature = "window")]
diff --git a/examples/window.rs b/examples/window.rs
index 400aa84..910d6e6 100644
--- a/examples/window.rs
+++ b/examples/window.rs
@@ -23,7 +23,7 @@ fn resize_callback(width: uint, height: uint) {
fn main() {
let mut window = glutin::Window::new().unwrap();
window.set_title("A fantastic window!");
- window.set_window_resize_callback(Some(resize_callback));
+ window.set_window_resize_callback(Some(resize_callback as fn(uint, uint)));
unsafe { window.make_current() };
let context = support::load(&window);
diff --git a/src/win32/init.rs b/src/win32/init.rs
index a205d0c..3cdf8d5 100644
--- a/src/win32/init.rs
+++ b/src/win32/init.rs
@@ -37,7 +37,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
// GetMessage must be called in the same thread as CreateWindow,
// so we create a new thread dedicated to this window.
// This is the only safe method. Using `nosend` wouldn't work for non-native runtime.
- spawn(move || {
+ ::std::thread::Thread::spawn(move || {
// registering the window class
let class_name = {
let class_name: Vec<u16> = "Window Class".utf16_units().chain(Some(0).into_iter())
@@ -69,8 +69,8 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
// building a RECT object with coordinates
let mut rect = winapi::RECT {
- left: 0, right: builder_dimensions.unwrap_or((1024, 768)).val0() as winapi::LONG,
- top: 0, bottom: builder_dimensions.unwrap_or((1024, 768)).val1() as winapi::LONG,
+ left: 0, right: builder_dimensions.unwrap_or((1024, 768)).0 as winapi::LONG,
+ top: 0, bottom: builder_dimensions.unwrap_or((1024, 768)).1 as winapi::LONG,
};
// switching to fullscreen if necessary
@@ -82,10 +82,10 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
// adjusting the rect
{
let pos = monitor.get_position();
- rect.left += pos.val0() as winapi::LONG;
- rect.right += pos.val0() as winapi::LONG;
- rect.top += pos.val1() as winapi::LONG;
- rect.bottom += pos.val1() as winapi::LONG;
+ rect.left += pos.0 as winapi::LONG;
+ rect.right += pos.0 as winapi::LONG;
+ rect.top += pos.1 as winapi::LONG;
+ rect.bottom += pos.1 as winapi::LONG;
}
// changing device settings
@@ -299,9 +299,9 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
if builder_gl_version.is_some() {
let version = builder_gl_version.as_ref().unwrap();
attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as libc::c_int);
- attributes.push(version.val0() as libc::c_int);
+ attributes.push(version.0 as libc::c_int);
attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as libc::c_int);
- attributes.push(version.val1() as libc::c_int);
+ attributes.push(version.1 as libc::c_int);
}
if builder_debug {
@@ -409,7 +409,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
unsafe { winapi::TranslateMessage(&msg) };
unsafe { winapi::DispatchMessageW(&msg) }; // calls `callback` (see below)
}
- });
+ }).detach();
rx.recv()
}