Can you RenderPresent when another fullscreen application is running?

Hi all,

For a bit of context, I’m making an overlay to track controller inputs to capture in OBS using SDL2. Nothing ground breaking there but I thought it would be a fun little project for me. All was going well, I have a windowed controller overlay that handles controller input events both in and out of focus.

However, if a fullscreen game is launched, SDL no longer presents a new frame. The program is still handling the controller inputs and running through my rendering code, but the screen doesn’t update. Tabbing back out of the fullscreen game puts the SDL application back to displaying as it should.

Is there a way to have the application render regardless of the window state? (it would also be useful to render while minimized).

As a bit of an add, neither SDL_WINDOWEVENT_HIDDEN is queued or the SDL_WINDOW_HIDDEN flag is set when the full screen game is launched. The returned window flag is 0x24.

Sorry it’s a little long winded but after a few hours of googling I haven’t been able to find a solution. Any help would be appreciated!

All the SDL_Render draw commands have this:

    /* Don't draw while we're hidden */
    if (renderer->hidden) {
        return 0;

…this probably a) wrong in general and b) going to break render targets if you try to create a texture for later use when the window is minimized.

(renderer->hidden is set to true when we see a hidden or minimized window event. Putting a different window fullscreen will probably trigger this for your window, even if has the SDL_WINDOW_SHOWN flag (0x4) set right after creation.)

I’m certain there was a bug report about this at some point, but I don’t remember what the resolution on that was.

That being said: if we remove this check, I can’t guarantee that the operating system won’t refuse to draw to your window if it’s offscreen anyhow (but I assume they will, to keep the compositor happy).

Yeah, found the bug report:

I’ve reopened this and will fix it for 2.0.16.


Thank you! I just wanted to clarify (though if it muddies the waters feel free to ignore), that I never saw a hidden window event appear and the 0x24 flag was being shown while the fullscreen application was running. I had tied SDL_GetWindowFlags to a button on the controller.

Thanks again! I look forward to having this functionality.

This should be fixed now, as of today’s commit: