SDL2 Borderless game window

Hello! I’m developing a game and I’m trying to get it to behave like a fullscreen borderless window, as many others do.

Currently, I’m calling SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP) but this causes the window to be minimized when it goes out of focus and also seems to resize it while doing so.

I’ve tried searching for topics regarding this, but could not find one that would give me a working solution.

I found one which seemed to be really close (although a bit cheating) but still didn’t work ( True borderless fullscreen behaviour ).
In Ubuntu, it created a window that was the size of my display, but it did not go over the taskbar or the upper bar (the one with the clock and stuff). Not yet sure what would happen in Windows, but probably something similar.

As such, I’d like to know if there is either:
1- a way to make it so the SDL window does not minimize when going out of focus in FULLSCREEN_DESKTOP
2- some other way to make a fullscreen borderless window that allows the user to change window focus without really affecting my window

Thanks in advance.

I’ve found out the answer for number 1 through another post someone made.
It had to do with SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS since according to SDL_hints.h it defaulted to true before 2.0.14 (I’m using 2.0.12), so I simply had to call SDL_SetHint


1 Like