macOS Sonoma (14.0) / Xcode 15.0 — Compatibility Fixes + Docs (#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:

- https://github.com/RustAudio/coreaudio-sys/issues/85
- https://github.com/rust-windowing/winit/issues/2876

---

## Changelog

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

---------

Co-authored-by: Peter Kristensen <peter@ptx.dk>
This commit is contained in:
Marco Buono 2023-09-27 19:41:16 -03:00 committed by GitHub
parent b6ead2be95
commit 20ed3e0e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);