-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
macOS window launch behaviour #5714
Comments
We don't directly interact with the respective api's. Instead we use winit. I think rust-windowing/winit#2051 describes the same issue as you are having. |
Well actually winit already made there stance on it so really what you can do and what I would like to see is delay the logic triggered by app.run() until the ApplicationDidFinishLauncing event fires on mac or by registering the activation policy on the current porcess before making the window. This is really Something that has to be fixed because this invites unexpected app behaviour on macos |
There are two ways to fix this:
#[cfg(target_os = "macos")]
unsafe {
use cocoa::{appkit::*,base::{NO,nil}};
let nsapp = NSApp();
NSApplication::setActivationPolicy_(nsapp, NSApplicationActivationPolicyRegular);
} to bevy_winit's plugin build functions, or
I'll have to know which one is preferred, than I'll submit a pr with the fix |
To someone not used to cocoa or apple APIs, the code snippet you posted looks a little like dark magic. I think waiting for the event could be preferred |
This PR (#5883) seems to be fixing the issue and is live on current main branch. Depending on when the next bevy version is meant to be released, it may be worth to bacport it to a bug fix 0.8.2 release, as current 0.8.1 is quite broken for on macOS. |
0.9 should be in roughly one month. I'm running on macOS and wouldn't call it quite broken |
For what it's worth, @Kees-van-Beilen's suggested code seems quite reasonable. Calling Cocoa from Rust does indeed look like scary |
Bevy version
0.8.0
[Optional] Relevant system information
What you did
Running any bevy proccess that launches a window
What went wrong
The window ignores macOS application rules (i.e. floating above fullscreen apps).
It should follow macOS application rules.
Additional information
This is quite an easy fix please make sure that
The text was updated successfully, but these errors were encountered: