mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-17 00:38:12 +00:00
Allow environment hint overrides before hints are initialized
Fixes https://github.com/libsdl-org/SDL/issues/10514
This commit is contained in:
@@ -196,23 +196,21 @@ const char *SDL_GetHint(const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE);
|
|
||||||
if (!hints) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *retval = SDL_getenv(name);
|
const char *retval = SDL_getenv(name);
|
||||||
|
|
||||||
SDL_LockProperties(hints);
|
const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE);
|
||||||
|
if (hints) {
|
||||||
|
SDL_LockProperties(hints);
|
||||||
|
|
||||||
SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL);
|
SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL);
|
||||||
if (hint) {
|
if (hint) {
|
||||||
if (!retval || hint->priority == SDL_HINT_OVERRIDE) {
|
if (!retval || hint->priority == SDL_HINT_OVERRIDE) {
|
||||||
retval = SDL_GetPersistentString(hint->value);
|
retval = SDL_GetPersistentString(hint->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SDL_UnlockProperties(hints);
|
SDL_UnlockProperties(hints);
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user