-
Notifications
You must be signed in to change notification settings - Fork 905
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
Incorrect focus events for windows created without focus #2102
Comments
So I put a the backtrace
|
I'm ignorant about the windows API so I don't know if this is helpful, and it sounds like you already have an approach to solve this, but I tried printing most window/thread events to see if I could find a sensible difference between when the window is/isn't focused. I was only able to spot one difference: the window is sent a
I don't see any windows event loop code handling |
Just a note that with #2159 merged, this issue should be resolved. |
On Windows 10, I've noticed that if
cargo run
takes a while to build my executable and I switch focus to another application, then the focus events sent to my executable are incorrect, preventing it from determining whether it's currently focused.Here's a minimal reproducible example:
The behavior I'd expect is at least one (ideally both) of the following:
winit
window receives aFocused(true)
event if it's created in a focused state.winit
window receives aFocused(false)
event if it's created in an unfocused state.With
winit
0.26.0, if you run this and focus another application during the 5 second wait, then thewinit
window will be created in the background, yet the application will receive aFocused(true)
event. If the application tries to act on this by grabbing the cursor (uncomment the lines near the end), then you end up with a strange situation where the cursor is constrained to the bounds of thewinit
window, despite another application having focus and being in front.With
winit
0.20.0 through 0.25.0, if you follow the above steps, then thewinit
window receives no event, even when focused for the first time.I haven't tested with versions of
winit
older than 0.20.0.The text was updated successfully, but these errors were encountered: