Skip to content

Commit

Permalink
chore: bump winit to 0.29.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kchibisov committed Aug 16, 2023
1 parent d059191 commit fa1823e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 38 deletions.
2 changes: 2 additions & 0 deletions glutin-winit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- **Breaking:** Update _winit_ to `0.29.0-beta.1`. See [winit's CHANGELOG](https://github.com/rust-windowing/winit/releases/tag/v0.29.0-beta.1) 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.
Expand Down
3 changes: 1 addition & 2 deletions glutin-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.0-beta.1", 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"
7 changes: 3 additions & 4 deletions glutin-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -192,7 +191,7 @@ pub fn finalize_window<T>(

#[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
};
Expand Down
5 changes: 3 additions & 2 deletions glutin-winit/src/window.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 2 additions & 3 deletions glutin_examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.0-beta.1", 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.0-beta.1", default-features = false, features = ["android-native-activity"] }

[build-dependencies]
gl_generator = "0.14"
Expand Down
4 changes: 2 additions & 2 deletions glutin_examples/examples/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
6 changes: 4 additions & 2 deletions glutin_examples/examples/window.rs
Original file line number Diff line number Diff line change
@@ -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<dyn Error>> {
glutin_examples::main(EventLoopBuilder::new().build().unwrap())
}
46 changes: 23 additions & 23 deletions glutin_examples/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<dyn Error>> {
// Only windows requires the window to be present before creating the display.
// Other platforms don't really need one.
//
Expand All @@ -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());

Expand Down Expand Up @@ -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();
Expand All @@ -184,7 +182,9 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) {
},
_ => (),
}
})
})?;

Ok(())
}

pub struct Renderer {
Expand Down

0 comments on commit fa1823e

Please sign in to comment.