From 4c0413bc7cbf83066014ca2334827fd8ccfbcfa7 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 24 Nov 2014 20:13:32 +0100 Subject: Implement lists sharing --- src/win32/init.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/win32/init.rs') 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)) pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: String, builder_monitor: Option, builder_gl_version: Option<(uint, uint)>, builder_debug: bool, - builder_vsync: bool, builder_hidden: bool) -> Result + builder_vsync: bool, builder_hidden: bool, + builder_sharelists: Option) -> Result { 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 } }; -- cgit v1.2.3