servo-glutin 0.4.8

Cross-plaform OpenGL context provider.
Documentation
commit c76229824501e3fdc14993e0216d8706fe9bc29f
Author: Vladimir Vukicevic <vladimir@pobox.com>
Date:   Tue Sep 22 09:00:02 2015 -0400

    Fix WindowAttribs to not include a *c_void member for serialization

diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs
index 2da53d6..d7c3c7f 100644
--- a/src/api/x11/window.rs
+++ b/src/api/x11/window.rs
@@ -401,13 +401,11 @@ impl Window {
             },
         };
 
-        // getting the parent window
-        let parent = if window_attrs.parent.is_null() {
-                         unsafe { (display.xlib.XDefaultRootWindow)(display.display) }
-        } else {
-            window_attrs.parent as ffi::Window
+        // getting the parent window; root if None
+        let parent = match window_attrs.parent {
+            Some(w) => w.window as ffi::Window,
+            None => unsafe { (display.xlib.XDefaultRootWindow)(display.display) }
         };
-        // getting the root window
 
         // creating the color map
         let cmap = unsafe {
diff --git a/src/lib.rs b/src/lib.rs
index 4a77482..406d1e0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -519,6 +519,23 @@ impl Default for PixelFormatRequirements {
     }
 }
 
+/// A wrapper for a native window pointer.
+#[derive(Debug, Clone)]
+pub struct WindowID {
+    pub window: *mut libc::c_void,
+}
+
+impl WindowID {
+    pub fn new(window: *mut libc::c_void) -> WindowID {
+        WindowID {
+            window: window
+        }
+    }
+}
+
+unsafe impl Send for WindowID {}
+unsafe impl Sync for WindowID {}
+
 /// Attributes to use when creating a window.
 #[derive(Clone)]
 pub struct WindowAttributes {
@@ -560,8 +577,8 @@ pub struct WindowAttributes {
 
     /// Parent Window.
     ///
-    /// The default is `std::ptr::null_mut()`
-    pub parent: WindowID,
+    /// The default is `None`.
+    pub parent: Option<WindowID>,
 }
 
 impl Default for WindowAttributes {
@@ -575,7 +592,7 @@ impl Default for WindowAttributes {
             transparent: false,
             decorations: true,
             multitouch: false,
-            parent: std::ptr::null_mut(),
+            parent: None,
         }
     }
 }
@@ -662,6 +679,3 @@ mod native_monitor {
         Unavailable
     }
 }
-
-/// Identifier for a display system window.
-pub type WindowID = *mut libc::c_void;
diff --git a/src/window.rs b/src/window.rs
index aa7804a..2f48d44 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -18,6 +18,7 @@ use Window;
 use WindowID;
 use WindowAttributes;
 use native_monitor::NativeMonitorId;
+use WindowID;
 
 use gl_common;
 use libc;
@@ -197,7 +198,7 @@ impl<'a> WindowBuilder<'a> {
     }
 
     /// Sets the parent window
-    pub fn with_parent(mut self, parent: WindowID) -> WindowBuilder<'a> {
+    pub fn with_parent(mut self, parent: Option<WindowID>) -> WindowBuilder<'a> {
         self.window.parent = parent;
         self
     }