From 310b44f35be8146623d8e5fbbe380ae14f30de72 Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Tue, 12 May 2015 22:47:34 +0200 Subject: Make platform::linux generic over X11 and Wayland. --- src/api/glx/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/api/glx/mod.rs') diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs index 9cda90e..3c0c8a0 100644 --- a/src/api/glx/mod.rs +++ b/src/api/glx/mod.rs @@ -14,6 +14,8 @@ use std::{mem, ptr}; use api::x11::ffi; +use platform::Window as PlatformWindow; + pub struct Context { glx: ffi::glx::Glx, display: *mut ffi::Display, @@ -80,9 +82,12 @@ impl Context { }); let share = if let Some(win) = builder.sharing { - match win.x.context { - ::api::x11::Context::Glx(ref c) => c.context, - _ => panic!("Cannot share contexts between different APIs") + match win { + &PlatformWindow::X(ref win) => match win.x.context { + ::api::x11::Context::Glx(ref c) => c.context, + _ => panic!("Cannot share contexts between different APIs") + }, + _ => panic!("Cannot use glx on a non-X11 window.") } } else { ptr::null() -- cgit v1.2.3