It looks like WS_POPUP doesn’t do much anymore, in fact I expect saving the background layer uses more RAM and maybe more CPU processing time.
Reading the whole page in the above link, there was a bit of change in purpose of the variable, so it could be of importance for some behavior of child windows.
Unless the window is meant to be a child/popup of another window, try disabling WS_POPUP at program startup and never re-enable it.
Let me do a bit more research and I’ll try to get back soon.
Edit:
I actually found the conversation you were involved in on github last week while searching, and SDL’s issue 11041, which was mentioned in the former. (I mention both because they may be helpful to someone else)
I see that Slouken basically says that the setup is worth some users hitting the delay, and that it’s partially an openGL optimization decision.
There is SDL_SyncWindow() which will attempt to pause the program until resize is completed, but I don’t think that helps delta-time games or online multiplayer.
Could you do me a favor and try hiding the window directly before calling the transitions to and from fullscreen?
So OpenGL is supposedly not going to be updated, and the head of SDL has said that this is not something they want to change.
I hate to say it, but I think the “hack” you initially presented with might be the correct way to go.
Since Slouken says that the optimization is worth the penalty, my recommend is to run an initial self-test, maybe figure out something clever so it only runs on the first launch of the program. Flip between fullscreen and restore, time it, and if SDL_EVENT_WINDOW_LEAVE_FULLSCREEN takes more than a tenth of a second to activate (adjust the timing to fit expectations), then initiate your code to remove the popup setting.
Did Sam exactly say that? It felt more to me like something that he was reluctant to risk changing, having been the way it is for so long. As another user of OpenGL in Windows, I’d prefer the WS_POPUP to be removed in SDL itself.
@rtrussell good point. So more testing should be done to see just how much WS_POPUP affects the average user’s computer. (It might be worth running the “hack” for all Windows users rather than just for those that receive a time penalty)
The OpenGL drivers have done this intentionally, to bypass the DWM compositor and get the best graphics performance. If you want to tweak window flags to break this, that’s fine, and you can submit a PR to add a hint for this if you want.
I don’t do github, could someone do that last part about submitting a PR to request/add an SDL_Hint?
As I understand it, in modern Windows WS_POPUP is supposed to be a hint that the window will be short-lived, such as a dialog box or a message box. SDL windows are typically not short-lived.
I don’t know anything about it beyond the quote above in which Slouken said that OpenGL uses it to bypass the window compositor… that removing WS_POPUP flag would break that bypass specifically for OpenGL.
Nope.
I generally sift through segments of source when I think it might help answer a posted question, never have I ever pushed my own code into SDL source.
I don’t like that github is owned by a major player like Microsoft, nor do I like that AI is allowed to scrub through github for training purposes.
I’d prefer to think that (attempting) answering questions here counts as contributing to the community.