Fix related to #36319: restore SDL_VIDEODRIVER=dummy environment variable, it

seems that somehow not having this is causing keyboard events to be caught by
SDL. This was removed because it broke addons that could use SDL, now set the
environment variable only temporary during SDL initialization.

This may have been causing issues with keyboard events getting missed in the
game engine, but I couldn't confirm the issue here.
This commit is contained in:
Brecht Van Lommel
2013-09-23 14:48:28 +00:00
parent 97cb65df52
commit eaf354e222
3 changed files with 45 additions and 12 deletions

View File

@@ -166,12 +166,23 @@ int uputenv(const char *name, const char *value)
{
int r = -1;
UTF16_ENCODE(name);
UTF16_ENCODE(value);
if (name_16 && value_16) {
r = (SetEnvironmentVariableW(name_16,value_16)!= 0) ? 0 : -1;
if (value) {
/* set */
UTF16_ENCODE(value);
if (name_16 && value_16) {
r = (SetEnvironmentVariableW(name_16,value_16)!= 0) ? 0 : -1;
}
UTF16_UN_ENCODE(value);
}
UTF16_UN_ENCODE(value);
else {
/* clear */
if (name_16) {
r = (SetEnvironmentVariableW(name_16,NULL)!= 0) ? 0 : -1;
}
}
UTF16_UN_ENCODE(name);
return r;