diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2014-11-24 20:51:59 +0100 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2014-11-24 20:51:59 +0100 |
commit | d7a7765638d4638c48e4b76477b32da6be7957b3 (patch) | |
tree | 49cbbce62bec8a6203ab731df87001b32cd7c81d /src/win32/init.rs | |
parent | 9668878f266dc23f8be353d804f7c99fb96767ac (diff) | |
parent | 4c0413bc7cbf83066014ca2334827fd8ccfbcfa7 (diff) | |
download | glutin-d7a7765638d4638c48e4b76477b32da6be7957b3.tar.gz glutin-d7a7765638d4638c48e4b76477b32da6be7957b3.zip |
Merge pull request #134 from tomaka/share-lists
Implement lists sharing
Diffstat (limited to 'src/win32/init.rs')
-rw-r--r-- | src/win32/init.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/win32/init.rs b/src/win32/init.rs index 1f5be09..29b45cb 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -15,7 +15,8 @@ local_data_key!(WINDOW: (ffi::HWND, Sender<Event>)) 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) -> Result<Window, CreationError> + builder_vsync: bool, builder_hidden: bool, + builder_sharelists: Option<ffi::HGLRC>) -> Result<Window, CreationError> { use std::mem; use std::os; @@ -305,10 +306,16 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin let ctxt = unsafe { if extra_functions.CreateContextAttribsARB.is_loaded() { - extra_functions.CreateContextAttribsARB(hdc, ptr::null(), - attributes.as_slice().as_ptr()) + let share = if let Some(c) = builder_sharelists { c } else { ptr::null() }; + extra_functions.CreateContextAttribsARB(hdc, share, + attributes.as_slice().as_ptr()) + } else { - ffi::wgl::CreateContext(hdc) + let ctxt = ffi::wgl::CreateContext(hdc); + if let Some(c) = builder_sharelists { + ffi::wgl::ShareLists(c, ctxt); + }; + ctxt } }; |