From 5182023fd6f14469290b80f0f5e9b0dead73048e Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 21 Sep 2015 11:52:21 +0200 Subject: Switch X11 and wayland to the new design --- src/api/wayland/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/api/wayland/mod.rs') diff --git a/src/api/wayland/mod.rs b/src/api/wayland/mod.rs index 56b9218..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 { + pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements, + opengl: &GlAttributes<&Window>) -> Result + { 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.window.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.window.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.window.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, &builder.opengl.clone().map_sharing(|_| unimplemented!()), // TODO: + 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 _)) ) -- cgit v1.2.3