diff options
Diffstat (limited to 'src/api/wayland/mod.rs')
-rw-r--r-- | src/api/wayland/mod.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/api/wayland/mod.rs b/src/api/wayland/mod.rs index 0381f31..10d2acb 100644 --- a/src/api/wayland/mod.rs +++ b/src/api/wayland/mod.rs @@ -1,4 +1,4 @@ -#![cfg(target_os = "linux")] +#![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))] #![allow(unused_variables, dead_code)] use self::wayland::egl::{EGLSurface, is_egl_available}; @@ -13,14 +13,16 @@ use api::dlopen; use api::egl; use api::egl::Context as EglContext; -use BuilderAttribs; use ContextError; use CreationError; use Event; use PixelFormat; use CursorState; use MouseCursor; +use GlAttributes; use GlContext; +use PixelFormatRequirements; +use WindowAttributes; use std::collections::VecDeque; use std::ops::{Deref, DerefMut}; @@ -241,7 +243,9 @@ impl<'a> Iterator for WaitEventsIterator<'a> { } impl Window { - pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> { + pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements, + opengl: &GlAttributes<&Window>) -> Result<Window, CreationError> + { use self::wayland::internals::FFI; let wayland_context = match *WAYLAND_CONTEXT { @@ -251,7 +255,7 @@ impl Window { if !is_egl_available() { return Err(CreationError::NotSupported) } - let (w, h) = builder.dimensions.unwrap_or((800, 600)); + let (w, h) = window.dimensions.unwrap_or((800, 600)); let surface = EGLSurface::new( wayland_context.compositor.create_surface(), @@ -259,12 +263,12 @@ impl Window { h as i32 ); - let mut shell_window = if let Some(PlatformMonitorID::Wayland(ref monitor)) = builder.monitor { + let mut shell_window = if let Some(PlatformMonitorID::Wayland(ref monitor)) = window.monitor { let shell_surface = wayland_context.shell.get_shell_surface(surface); shell_surface.set_fullscreen(ShellFullscreenMethod::Default, Some(&monitor.output)); ShellWindow::Plain(shell_surface) } else { - if builder.decorations { + if window.decorations { ShellWindow::Decorated(match DecoratedSurface::new( surface, w as i32, @@ -291,7 +295,7 @@ impl Window { }); try!(EglContext::new( egl, - &builder, + pf_reqs, &opengl.clone().map_sharing(|_| unimplemented!()), // TODO: egl::NativeDisplay::Wayland(Some(wayland_context.display.ptr() as *const _))) .and_then(|p| p.finish((**shell_window.get_shell()).ptr() as *const _)) ) |