From eaf354e222ec64dc0e258a53107ef1eca9ac341c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 23 Sep 2013 14:48:28 +0000 Subject: 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. --- intern/utfconv/utf_winfunc.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'intern') diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c index 2ae261b44a8..19917571b5e 100644 --- a/intern/utfconv/utf_winfunc.c +++ b/intern/utfconv/utf_winfunc.c @@ -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; -- cgit v1.2.3