diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-09-21 14:15:41 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-09-21 14:15:41 +0200 |
commit | 6787f1d43493f0f8c2310ac3c3d5cb409d13ec40 (patch) | |
tree | 03056bc49bd5ec0da9e155176a74c2d23a8fc603 /src/api/wayland/mod.rs | |
parent | f51ace4c7885fa25c146c24181c4d87f5632de3e (diff) | |
parent | 62bafe2130db5aaf32bd46091581086ae435e4cf (diff) | |
download | glutin-6787f1d43493f0f8c2310ac3c3d5cb409d13ec40.tar.gz glutin-6787f1d43493f0f8c2310ac3c3d5cb409d13ec40.zip |
Merge pull request #603 from tomaka/gl-attribs
Separate the builder attributes into multiple substates
Diffstat (limited to 'src/api/wayland/mod.rs')
-rw-r--r-- | src/api/wayland/mod.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/api/wayland/mod.rs b/src/api/wayland/mod.rs index b46e2d1..10d2acb 100644 --- a/src/api/wayland/mod.rs +++ b/src/api/wayland/mod.rs @@ -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 _)) ) |