diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 3a949be7..c326da6e 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -9,7 +9,7 @@ vulkano = { path = "../vulkano" } vulkano-win = { path = "../vulkano-win" } cgmath = "0.7.0" image = "0.6.1" -winit = "0.5.0" +winit = "0.5.1" [build-dependencies] vk-sys = { path = "../vk-sys" } diff --git a/vulkano-win/Cargo.toml b/vulkano-win/Cargo.toml index e8dd2558..80185066 100644 --- a/vulkano-win/Cargo.toml +++ b/vulkano-win/Cargo.toml @@ -8,4 +8,4 @@ license = "MIT/Apache-2.0" [dependencies] vulkano = { version = "0.1.0", path = "../vulkano" } -winit = "0.5.0" +winit = "0.5.1" diff --git a/vulkano-win/src/lib.rs b/vulkano-win/src/lib.rs index e503e8d0..5e6aac5d 100644 --- a/vulkano-win/src/lib.rs +++ b/vulkano-win/src/lib.rs @@ -22,7 +22,7 @@ pub fn required_extensions() -> InstanceExtensions { khr_mir_surface: true, khr_android_surface: true, khr_win32_surface: true, - .. InstanceExtensions::none() + ..InstanceExtensions::none() }; let supported = InstanceExtensions::supported_by_core(); @@ -111,26 +111,35 @@ impl From for CreationError { } #[cfg(target_os = "android")] -unsafe fn winit_to_surface(instance: &Arc, win: &winit::Window) - -> Result, SurfaceCreationError> -{ +unsafe fn winit_to_surface(instance: &Arc, + win: &winit::Window) + -> Result, SurfaceCreationError> { use winit::os::android::WindowExt; Surface::from_anativewindow(instance, win.get_native_window()) } #[cfg(all(unix, not(target_os = "android")))] -unsafe fn winit_to_surface(instance: &Arc, win: &winit::Window) - -> Result, SurfaceCreationError> -{ +unsafe fn winit_to_surface(instance: &Arc, + win: &winit::Window) + -> Result, SurfaceCreationError> { use winit::os::unix::WindowExt; - Surface::from_xlib(instance, win.get_xlib_display().unwrap(), - win.get_xlib_window().unwrap()) + match (win.get_wayland_display(), win.get_wayland_surface()) { + (Some(display), Some(surface)) => Surface::from_wayland(instance, display, surface), + _ => { + // No wayland display found, assume xlib will work. + Surface::from_xlib(instance, + win.get_xlib_display().unwrap(), + win.get_xlib_window().unwrap()) + } + } } #[cfg(windows)] -unsafe fn winit_to_surface(instance: &Arc, win: &winit::Window) - -> Result, SurfaceCreationError> -{ +unsafe fn winit_to_surface(instance: &Arc, + win: &winit::Window) + -> Result, SurfaceCreationError> { use winit::os::windows::WindowExt; - Surface::from_hwnd(instance, ptr::null() as *const () /* FIXME */, win.get_hwnd()) + Surface::from_hwnd(instance, + ptr::null() as *const (), // FIXME + win.get_hwnd()) }