Set SDL hints before initialization

In theory, some SDL hints should be initialized before calling
SDL_Init().
This commit is contained in:
Romain Vimont 2021-10-31 10:35:58 +01:00
parent a57c7d3a2b
commit ac539e1312

View file

@ -115,6 +115,10 @@ sdl_set_hints(const char *render_driver) {
static bool static bool
sdl_init_and_configure(bool display, const char *render_driver, sdl_init_and_configure(bool display, const char *render_driver,
bool disable_screensaver) { bool disable_screensaver) {
if (display) {
sdl_set_hints(render_driver);
}
uint32_t flags = display ? SDL_INIT_VIDEO : SDL_INIT_EVENTS; uint32_t flags = display ? SDL_INIT_VIDEO : SDL_INIT_EVENTS;
if (SDL_Init(flags)) { if (SDL_Init(flags)) {
LOGC("Could not initialize SDL: %s", SDL_GetError()); LOGC("Could not initialize SDL: %s", SDL_GetError());
@ -135,8 +139,6 @@ sdl_init_and_configure(bool display, const char *render_driver,
return true; return true;
} }
sdl_set_hints(render_driver);
if (disable_screensaver) { if (disable_screensaver) {
LOGD("Screensaver disabled"); LOGD("Screensaver disabled");
SDL_DisableScreenSaver(); SDL_DisableScreenSaver();