diff options
author | Victor Berger <victor.berger@m4x.org> | 2015-05-12 22:47:34 +0200 |
---|---|---|
committer | Victor Berger <victor.berger@m4x.org> | 2015-05-12 22:49:03 +0200 |
commit | 310b44f35be8146623d8e5fbbe380ae14f30de72 (patch) | |
tree | 8103ea05599c35ea2559f11ef4392702523c17a4 /src/api/x11 | |
parent | 3279f15f9f0ff24c644479e73923a0cb64f99fda (diff) | |
download | glutin-310b44f35be8146623d8e5fbbe380ae14f30de72.tar.gz glutin-310b44f35be8146623d8e5fbbe380ae14f30de72.zip |
Make platform::linux generic over X11 and Wayland.
Diffstat (limited to 'src/api/x11')
-rw-r--r-- | src/api/x11/mod.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/api/x11/mod.rs b/src/api/x11/mod.rs index 0dcf85b..30adadc 100644 --- a/src/api/x11/mod.rs +++ b/src/api/x11/mod.rs @@ -21,6 +21,8 @@ use api::dlopen; use api::glx::Context as GlxContext; use api::egl::Context as EglContext; +use platform::MonitorID as PlatformMonitorID; + pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor}; mod events; @@ -310,9 +312,9 @@ pub struct Window { impl Window { pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> { - let xlib = ffi::Xlib::open().unwrap(); // FIXME: gracious handling - let xcursor = ffi::Xcursor::open().unwrap(); // FIXME: gracious handling - let xf86vmode = ffi::Xf86vmode::open().unwrap(); // FIXME: gracious handling + let xlib = try!(ffi::Xlib::open().map_err(|_| CreationError::NotSupported)); + let xcursor = try!(ffi::Xcursor::open().map_err(|_| CreationError::NotSupported)); + let xf86vmode = try!(ffi::Xf86vmode::open().map_err(|_| CreationError::NotSupported)); let glx = { let mut libglx = unsafe { dlopen::dlopen(b"libGL.so.1\0".as_ptr() as *const _, dlopen::RTLD_NOW) }; @@ -342,8 +344,8 @@ impl Window { }; let screen_id = match builder.monitor { - Some(MonitorID(monitor)) => monitor as i32, - None => unsafe { (xlib.XDefaultScreen)(display) }, + Some(PlatformMonitorID::X(MonitorID(monitor))) => monitor as i32, + _ => unsafe { (xlib.XDefaultScreen)(display) }, }; // getting the FBConfig |