-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong size when resizing window on MacOS Sonoma (Beta) #2876
Comments
Experienced a similar issue after upgrading to the macOS Sonoma developer beta in my Bevy 0.10.1 app.
I'm looking for a workaround at this point. |
As a temporary workaround I run my app with WindowMode::BorderlessFullscreen as opposed to default Windowed. |
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
mode: WindowMode::BorderlessFullscreen,
..default()
}),
..default()
}))
.add_startup_system(setup)
.run();
} I try this succeed on official 3d scene example code 3d scene |
Yup @weykon workaround works for me, interesting why it can't handle windowed mode 🤔 |
It occurred after already being on sonoma beta 2 but later updating the command line tools and xcode to Command_Line_Tools_for_Xcode_15_beta_2 and xocde beta 2 |
It would be nice to get a |
I used to try out this example https://github.com/StarArawn/bevy_ecs_tilemap/blob/main/examples/mouse_to_tile.rs of this lib https://github.com/StarArawn/bevy_ecs_tilemap/tree/main OS: MacOS 14 beta 2 on M1
Log:
|
I believe this is not an issue with |
I thinkthe problematic part would be the call to winit/src/platform_impl/macos/view.rs Line 233 in 81fd394
I think this call for some reason now returns a null rectangle, which we fail to check? My Mac is not new enough to do the verification on that OS myself, though perhaps we can just skip the event if the view rectangle is invalid? Maybe someone could put a |
What is the status of this bug? I still have the issue that only the workaround with |
Working fine on Sonoma until I attempted to run it on an external monitor and got this error. |
Yeah, I tested with external monitor as well, maybe they fixed it in new betas for internal monitor 🤔 |
Nope I still get this error when not having my external monitor attached. Here's the main.rs file of the project I used use bevy::{
prelude::*,
sprite::MaterialMesh2dBundle,
window::{PrimaryWindow, WindowMode},
};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
//mode: WindowMode::BorderlessFullscreen,
..default()
}),
..default()
}))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn(NodeBundle {
style: Style {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
..default()
},
background_color: Color::RED.into(),
..default()
});
}
fn testing(window_query: Query<&Window, With<PrimaryWindow>>) {
let window = window_query.single();
println!("{}", window.width());
println!("{}", window.height());
} this results in the following error which I think is almost the exact same as the one posted at the beginning of this issue
Ohh and it works if you uncomment the line that enabled fullscreen... |
All, please state your macOS build number, in case the issue have been fixed in a newer beta. I tried running this myself in a virtualized setup with macOS 14 Beta 6 build 23A5328b, and could not reproduce the issue; but since this was a virtualized setup, I didn't have the ability to connect an external monitor, so that may still be an issue. It would be immensely helpful if someone could try the following patch, with a diff --git a/src/platform_impl/macos/view.rs b/src/platform_impl/macos/view.rs
index c8e34e4aa..719ec0b92 100644
--- a/src/platform_impl/macos/view.rs
+++ b/src/platform_impl/macos/view.rs
@@ -224,7 +224,8 @@ declare_class!(
self.removeTrackingRect(tracking_rect);
}
- let rect = self.visibleRect();
+ dbg!(self.frame());
+ let rect = dbg!(self.visibleRect());
let tracking_rect = self.add_tracking_rect(rect, false);
self.state.tracking_rect.set(Some(tracking_rect));
|
The error is still present in the latest developer beta (
|
I currently use the following hack in my project: (as part of my event handler) WindowEvent::Resized(physical_size) => {
if physical_size.width == u32::MAX || physical_size.height == u32::MAX {
// HACK to fix a bug on Macos 14
return;
}
state.resize(*physical_size);
} |
Thank you, that's very useful! I had been wondering in the past why we're using I need to do a little bit more testing, but otherwise I think I'm ready to just replace |
Since this is affecting a lot of people, we're doing a backport and releasing |
Okay, v0.28.7 has been released. |
# 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 <peter@ptx.dk>
…rtup) (#3763) ### What winit had a macOS Sonoma issue related to windows size that would yield this sort of UI on launch: <img width="1974" alt="image" src="https://github.com/rerun-io/rerun/assets/49431240/a2659416-ec6c-412e-8a84-3e1ac0f1ebd4"> It has been addressed in the latest release (see rust-windowing/winit#2876), which this PR updates to. Fixes #3761 ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3763) (if applicable) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG - [PR Build Summary](https://build.rerun.io/pr/3763) - [Docs preview](https://rerun.io/preview/ff2bed3995a12ebb34503ce4c787cbf51f278819/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/ff2bed3995a12ebb34503ce4c787cbf51f278819/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://ref.rerun.io/dev/bench/) - [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
…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 <peter@ptx.dk>
# 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 <peter@ptx.dk>
When I resize my window on MacOS Sonoma, I get the following window size as my new size: 4294967295x4294967295.
This does not look like valid values to me.
I'm not sure if it's a macOS or winit bug at this point, but I still thought I'd open an issue in case others encounter the same problem.
The text was updated successfully, but these errors were encountered: