Allow the creation of a Window in a not focused state #9208
+11
−1
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
Allow creating a new window without it being focused, when
Window
'sfocused
is `false.Solution
Use
winit
'sWindowBuilder
'swith_active
methodNotes
winit
's doc lists redox'sOrbital
as an unsupported platform, but since Bevy doesn't officially support this platform, I didn't put it in the documentation.Window
'sfocused
towinit_window.has_focus()
after window creation to avoid the case wherewith_active
is not supported, the window is spawned focused, noWindowFocused
event is triggered, and BevyWindow
would be desynced from winit's window. But after testing on Linux (which doesn't supportwith_active
) it seems like at that pointhas_focus
returnsfalse
and the event is triggered, so I removed it. Do you think I should add it back to be safe?Changelog
Window
can be created by settingfocused
tofalse
.Migration Guide
Window
is spawned withfocused
set tofalse
, it will now start not focused on supported platforms.