diff --git a/glutin-winit/CHANGELOG.md b/glutin-winit/CHANGELOG.md index d0d93a9ca2..3f6c61d2b7 100644 --- a/glutin-winit/CHANGELOG.md +++ b/glutin-winit/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- **Breaking:** Update _winit_ to `0.29.1-beta`. See [winit's CHANGELOG](https://github.com/rust-windowing/winit/releases/tag/v0.29.1-beta) for more info. + # Version 0.4.0-beta.0 - **Breaking:** Update _winit_ to `0.29.0-beta.0`. See [winit's CHANGELOG](https://github.com/rust-windowing/winit/releases/tag/v0.29.0-beta.0) for more info. diff --git a/glutin-winit/Cargo.toml b/glutin-winit/Cargo.toml index 3ed75e45a7..10ad911aff 100644 --- a/glutin-winit/Cargo.toml +++ b/glutin-winit/Cargo.toml @@ -18,9 +18,8 @@ x11 = ["glutin/x11", "winit/x11"] wayland = ["glutin/wayland", "winit/wayland"] [dependencies] -winit = { version = "0.29.0-beta.0", default-features = false } +winit = { version = "0.29.1-beta", default-features = false } glutin = { version = "0.30.1", path = "../glutin", default-features = false } -raw-window-handle = "0.5.0" [build-dependencies] cfg_aliases = "0.1.1" diff --git a/glutin-winit/src/lib.rs b/glutin-winit/src/lib.rs index 4898bec6bf..de6cd5cc9c 100644 --- a/glutin-winit/src/lib.rs +++ b/glutin-winit/src/lib.rs @@ -20,13 +20,12 @@ use glutin::display::{Display, DisplayApiPreference}; use glutin::platform::x11::X11GlConfigExt; use glutin::prelude::*; -use raw_window_handle::{HasRawDisplayHandle, RawWindowHandle}; - #[cfg(wgl_backend)] -use raw_window_handle::HasRawWindowHandle; +use winit::window::raw_window_handle::HasRawWindowHandle; use winit::error::OsError; use winit::event_loop::EventLoopWindowTarget; +use winit::window::raw_window_handle::{HasRawDisplayHandle, RawWindowHandle}; use winit::window::{Window, WindowBuilder}; #[cfg(glx_backend)] @@ -192,7 +191,7 @@ pub fn finalize_window( #[cfg(x11_platform)] let builder = if let Some(x11_visual) = gl_config.x11_visual() { - builder.with_x11_visual(x11_visual.into_raw()) + builder.with_x11_visual(x11_visual.visual_id() as _) } else { builder }; diff --git a/glutin-winit/src/window.rs b/glutin-winit/src/window.rs index 91ccec0f53..b222c6ed10 100644 --- a/glutin-winit/src/window.rs +++ b/glutin-winit/src/window.rs @@ -1,10 +1,11 @@ +use std::num::NonZeroU32; + use glutin::context::PossiblyCurrentContext; use glutin::surface::{ GlSurface, ResizeableSurface, Surface, SurfaceAttributes, SurfaceAttributesBuilder, SurfaceTypeTrait, WindowSurface, }; -use raw_window_handle::HasRawWindowHandle; -use std::num::NonZeroU32; +use winit::window::raw_window_handle::HasRawWindowHandle; use winit::window::Window; /// [`Window`] extensions for working with [`glutin`] surfaces. diff --git a/glutin_examples/Cargo.toml b/glutin_examples/Cargo.toml index 3720426bce..06b4371254 100644 --- a/glutin_examples/Cargo.toml +++ b/glutin_examples/Cargo.toml @@ -20,13 +20,12 @@ wayland = ["glutin-winit/wayland", "winit/wayland-dlopen", "winit/wayland-csd-ad [dependencies] glutin = { path = "../glutin", default-features = false } -winit = { version = "0.29.0-beta.0", default-features = false } +winit = { version = "0.29.1-beta", default-features = false } glutin-winit = { path = "../glutin-winit", default-features = false } -raw-window-handle = "0.5.0" png = { version = "0.17.6", optional = true } [target.'cfg(target_os = "android")'.dependencies] -winit = { version = "0.29.0-beta.0", default-features = false, features = ["android-native-activity"] } +winit = { version = "0.29.1-beta", default-features = false, features = ["android-native-activity"] } [build-dependencies] gl_generator = "0.14" diff --git a/glutin_examples/examples/android.rs b/glutin_examples/examples/android.rs index 4de5e05595..fcd3bb31c1 100644 --- a/glutin_examples/examples/android.rs +++ b/glutin_examples/examples/android.rs @@ -5,6 +5,6 @@ use winit::platform::android::EventLoopBuilderExtAndroid; #[no_mangle] fn android_main(app: winit::platform::android::activity::AndroidApp) { - let event_loop = EventLoopBuilder::new().with_android_app(app).build(); - glutin_examples::main(event_loop) + let event_loop = EventLoopBuilder::new().with_android_app(app).build().unwrap(); + glutin_examples::main(event_loop).unwrap() } diff --git a/glutin_examples/examples/window.rs b/glutin_examples/examples/window.rs index 28f2342870..f2c97c6026 100644 --- a/glutin_examples/examples/window.rs +++ b/glutin_examples/examples/window.rs @@ -1,5 +1,7 @@ +use std::error::Error; + use winit::event_loop::EventLoopBuilder; -fn main() { - glutin_examples::main(EventLoopBuilder::new().build()) +fn main() -> Result<(), Box> { + glutin_examples::main(EventLoopBuilder::new().build().unwrap()) } diff --git a/glutin_examples/src/lib.rs b/glutin_examples/src/lib.rs index 369d3d0a0b..46ab5da24e 100644 --- a/glutin_examples/src/lib.rs +++ b/glutin_examples/src/lib.rs @@ -1,12 +1,12 @@ +use std::error::Error; use std::ffi::{CStr, CString}; use std::num::NonZeroU32; use std::ops::Deref; use winit::event::{Event, WindowEvent}; +use winit::window::raw_window_handle::HasRawWindowHandle; use winit::window::WindowBuilder; -use raw_window_handle::HasRawWindowHandle; - use glutin::config::ConfigTemplateBuilder; use glutin::context::{ContextApi, ContextAttributesBuilder, Version}; use glutin::display::GetGlDisplay; @@ -22,7 +22,7 @@ pub mod gl { pub use Gles2 as Gl; } -pub fn main(event_loop: winit::event_loop::EventLoop<()>) { +pub fn main(event_loop: winit::event_loop::EventLoop<()>) -> Result<(), Box> { // Only windows requires the window to be present before creating the display. // Other platforms don't really need one. // @@ -44,24 +44,22 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) { let display_builder = DisplayBuilder::new().with_window_builder(window_builder); - let (mut window, gl_config) = display_builder - .build(&event_loop, template, |configs| { - // Find the config with the maximum number of samples, so our triangle will - // be smooth. - configs - .reduce(|accum, config| { - let transparency_check = config.supports_transparency().unwrap_or(false) - & !accum.supports_transparency().unwrap_or(false); - - if transparency_check || config.num_samples() > accum.num_samples() { - config - } else { - accum - } - }) - .unwrap() - }) - .unwrap(); + let (mut window, gl_config) = display_builder.build(&event_loop, template, |configs| { + // Find the config with the maximum number of samples, so our triangle will + // be smooth. + configs + .reduce(|accum, config| { + let transparency_check = config.supports_transparency().unwrap_or(false) + & !accum.supports_transparency().unwrap_or(false); + + if transparency_check || config.num_samples() > accum.num_samples() { + config + } else { + accum + } + }) + .unwrap() + })?; println!("Picked a config with {} samples", gl_config.num_samples()); @@ -173,7 +171,7 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) { }, _ => (), }, - Event::RedrawEventsCleared => { + Event::AboutToWait => { if let Some((gl_context, gl_surface, window)) = &state { let renderer = renderer.as_ref().unwrap(); renderer.draw(); @@ -184,7 +182,9 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) { }, _ => (), } - }) + })?; + + Ok(()) } pub struct Renderer {