message: Make the constructors for the headless context accept generic contexts
diff: @@ -9,7 +9,7 @@ use std::cell::RefCell;
  use std::ops::Deref;
  use std::os::raw::c_void;
  use super::glutin;
  -use super::glutin::PossiblyCurrent as Pc;
  +use super::glutin::{PossiblyCurrent as Pc, ContextCurrentState};
  use takeable_option::Takeable;
  /// A headless glutin context.
  @@ -77,7 +77,7 @@ impl Headless {
  ///
  /// Performs a compatibility check to make sure that all core elements of glium are supported
  /// by the implementation.
  - pub fn new(context: glutin::Context<Pc>) -> Result<Self, IncompatibleOpenGl> {
  + pub fn new<T: ContextCurrentState>(context: glutin::Context<T>) -> Result<Self, IncompatibleOpenGl> {
  Self::with_debug(context, Default::default())
  }
  @@ -85,32 +85,35 @@ impl Headless {
  ///
  /// This function does the same as `build_glium`, except that the resulting context
  /// will assume that the current OpenGL context will never change.
  - pub unsafe fn unchecked(context: glutin::Context<Pc>) -> Result<Self, IncompatibleOpenGl> {
  + pub unsafe fn unchecked<T: ContextCurrentState>(context: glutin::Context<T>) -> Result<Self, IncompatibleOpenGl> {
  Self::unchecked_with_debug(context, Default::default())
  }
  /// The same as the `new` constructor, but allows for specifying debug callback behaviour.
  - pub fn with_debug(context: glutin::Context<Pc>, debug: debug::DebugCallbackBehavior)
  + pub fn with_debug<T: ContextCurrentState>(context: glutin::Context<T>, debug: debug::DebugCallbackBehavior)
  -> Result<Self, IncompatibleOpenGl>
  {
  Self::new_inner(context, debug, true)
  }
  /// The same as the `unchecked` constructor, but allows for specifying debug callback behaviour.
  - pub unsafe fn unchecked_with_debug(
  - context: glutin::Context<Pc>,
  + pub unsafe fn unchecked_with_debug<T: ContextCurrentState>(
  + context: glutin::Context<T>,
  debug: debug::DebugCallbackBehavior,
  ) -> Result<Self, IncompatibleOpenGl>
  {
  Self::new_inner(context, debug, false)
  }
  - fn new_inner(
  - context: glutin::Context<Pc>,
  + fn new_inner<T: ContextCurrentState>(
  + context: glutin::Context<T>,
  debug: debug::DebugCallbackBehavior,
  checked: bool,
  ) -> Result<Self, IncompatibleOpenGl>
  {
  + let context = unsafe {
  + context.treat_as_current()
  + };
  let glutin_context = Rc::new(RefCell::new(Takeable::new(context)));
  let glutin_backend = GlutinBackend(glutin_context.clone());
  let context = try!(unsafe { context::Context::new(glutin_backend, checked, debug) });
  