| Summary: | OpenGL window doesn't produce SDL_WINDOWEVENT_FOCUS_LOST or SDL_APP_DIDENTERBACKGROUND | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Anthony @ POW Games <ant> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus |
| Version: | HG 2.0 | Keywords: | target-2.0.10 |
| Hardware: | All | ||
| OS: | Windows 10 | ||
|
Description
Anthony @ POW Games
2019-03-28 23:02:14 UTC
Tagging a bunch of bugs with "target-2.0.10" so we have a clear list of things to address before a 2.0.10 release. Please note that "addressing" one of these bugs might mean deciding to defer on it until after 2.0.10, or resolving it as WONTFIX, etc. This is just here to tell us we should look at it carefully, and soon. If you have new information or feedback on this issue, this is a good time to add it to the conversation, as we're likely to be paying attention to this specific report in the next few days/weeks. Thanks! --ryan. Haven't looked further, but bisecting says this is the culprit: https://hg.libsdl.org/SDL/rev/fbfacc66c65c --ryan. Documenting this because it took awhile to track down, but the tl;dr is this bug is fixed in revision control. Okay, so this happens because we ignore WM_ACTIVATE messages when the window isn't visible, but specifically for the OpenGL renderer, we'll call SDL_RecreateWindow() if the window doesn't have the SDL_WINDOW_OPENGL flag already (this is by design; you aren't supposed to supply this flag even if you explicitly plan to use the GL renderer backend). This is why you don't see this problem with Direct3D. SDL_RecreateWindow() explicitly hides the window while it does its magic, and when hiding a window, Win32 sends a WM_ACTIVATE which we ignore. Ignoring that means we never reset what window we think has the keyboard focus, etc, causing this problem, and why it fixes itself after the first time: once we stop ignoring WM_ACTIVATE calls, the state gets unconfused after a few of these messages arrive. What I ended up doing was only ignore activate messages when we are becoming active while still hidden, instead of ignoring them all. I'm not sure this is _correct_ fix, and I'm not sure if ever ignoring WM_ACTIVATE is a good idea, but I think this at least resolves this issue without regressing on the reason the ignoring was done in the first place. So...fixed in https://hg.libsdl.org/SDL/rev/2f882d435abf as far as I can tell. --ryan. |