Skip to content

Commit

Permalink
macOS Sonoma (14.0) / Xcode 15.0 — Compatibility Fixes + Docs (bevyen…
Browse files Browse the repository at this point in the history
…gine#9905)

# Objective

Improve compatibility with macOS Sonoma and Xcode 15.0.

## Solution

- Adds the workaround by @ptxmac to ignore the invalid window sizes
provided by `winit` on macOS 14.0
- This still provides a slightly wrong content size when resizing (it
fails to account for the window title bar, so some content gets clipped
at the bottom) but it's _much better_ than crashing.
- Adds docs on how to work around the `bindgen` bug on Xcode 15.0.

## Related Issues:

- RustAudio/coreaudio-sys#85
- rust-windowing/winit#2876

---

## Changelog

- Added a workaround for a `winit`-related crash under macOS Sonoma
(14.0)

---------

Co-authored-by: Peter Kristensen <[email protected]>
  • Loading branch information
coreh and ptxmac authored Sep 27, 2023
1 parent b6ead2b commit 20ed3e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,14 @@ pub fn winit_runner(mut app: App) {

match event {
WindowEvent::Resized(size) => {
// TODO: Remove this once we upgrade winit to a version with the fix
#[cfg(target_os = "macos")]
if size.width == u32::MAX || size.height == u32::MAX {
// HACK to fix a bug on Macos 14
// https://github.com/rust-windowing/winit/issues/2876
return;
}

window
.resolution
.set_physical_resolution(size.width, size.height);
Expand Down

0 comments on commit 20ed3e0

Please sign in to comment.