Respect Window::focused when requesting macOS app activation on startup and window creation#24702
Open
ariofrio wants to merge 3 commits into
Open
Respect Window::focused when requesting macOS app activation on startup and window creation#24702ariofrio wants to merge 3 commits into
Window::focused when requesting macOS app activation on startup and window creation#24702ariofrio wants to merge 3 commits into
Conversation
Window::focused on startup and window creationWindow::focused when requesting macOS app activation on startup and window creation
Contributor
|
You added a new feature but didn't add a description for it. Please update the root Cargo.toml file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Solution
The design principle is that
focusedshould result in similar behavior on macOS as in other supported platforms (i.e. Windows). This means managing app activation to result in the expected window focusing behavior.with_activate_ignoring_other_appsto false if the primary window should be unfocused on startup, or if there is no primary windowfocus_windowwhen a focused window is created to ensure app activation is requested, so that apps that delay creating the first window can still activate the app if desired.Alternatives Considered
macos_activate_ignoring_other_appssetting tobevy_winit. This is poorly discoverable and has footguns, e.g. what happens when a focused window is created when the app is not activated.Testing
Tested programmatically on macOS Tahoe 26.5 by checking
NSWorkspace.shared.frontmostApplicationbefore and after creating an additional window usingbevy_remote:Window { focused: true }Window { focused: false }focused: falsefocused: trueprimary_window: Noneprimary_window: None, then create visibleWindow { focused: true }primary_window: None, then create visibleWindow { focused: false }focused: falseWindow { focused: false }, then setfocused = trueShowcase
See migration guide.