aboutsummaryrefslogtreecommitdiffstats
path: root/src/win32/init.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-12-30 08:31:09 +0100
committertomaka <pierre.krieger1708@gmail.com>2014-12-30 08:31:09 +0100
commit32faad403b19f974733ddf531d61dc8d842af288 (patch)
tree0b23538cd302d3bd42c6784a74b0c8df882a74dc /src/win32/init.rs
parent29bf3385add5ee9306452fe605984838ecfaa1a5 (diff)
parentb9a6366f96e14e396452da443b64a10ee480fabf (diff)
downloadglutin-32faad403b19f974733ddf531d61dc8d842af288.tar.gz
glutin-32faad403b19f974733ddf531d61dc8d842af288.zip
Merge pull request #178 from tomaka/update-rustc
Update for changes in Send/Sync traits
Diffstat (limited to 'src/win32/init.rs')
-rw-r--r--src/win32/init.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/win32/init.rs b/src/win32/init.rs
index 3cdf8d5..7b236b0 100644
--- a/src/win32/init.rs
+++ b/src/win32/init.rs
@@ -18,11 +18,15 @@ use winapi;
/// receive an event for another window.
thread_local!(static WINDOW: Rc<RefCell<Option<(winapi::HWND, Sender<Event>)>>> = Rc::new(RefCell::new(None)));
+/// Work-around the fact that HGLRC doesn't implement Send
+pub struct ContextHack(pub winapi::HGLRC);
+unsafe impl Send for ContextHack {}
+
pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: String,
builder_monitor: Option<super::MonitorID>,
builder_gl_version: Option<(uint, uint)>, builder_debug: bool,
builder_vsync: bool, builder_hidden: bool,
- builder_sharelists: Option<winapi::HGLRC>, builder_multisampling: Option<u16>)
+ builder_sharelists: Option<ContextHack>, builder_multisampling: Option<u16>)
-> Result<Window, CreationError>
{
use std::mem;
@@ -38,6 +42,8 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
// 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.
::std::thread::Thread::spawn(move || {
+ let builder_sharelists = builder_sharelists.map(|s| s.0);
+
// registering the window class
let class_name = {
let class_name: Vec<u16> = "Window Class".utf16_units().chain(Some(0).into_iter())