diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/main-common.c | 2 | ||||
-rw-r--r-- | android/skin/window.c | 6 | ||||
-rw-r--r-- | android/utils/setenv.c | 18 |
3 files changed, 19 insertions, 7 deletions
diff --git a/android/main-common.c b/android/main-common.c index 94accf7..a0e5f56 100644 --- a/android/main-common.c +++ b/android/main-common.c @@ -524,7 +524,7 @@ init_sdl_ui(AConfig* skinConfig, #endif /* we're not a game, so allow the screensaver to run */ - putenv("SDL_VIDEO_ALLOW_SCREENSAVER=1"); + setenv("SDL_VIDEO_ALLOW_SCREENSAVER","1",1); flags = SDL_INIT_NOPARACHUTE; if (!opts->no_window) diff --git a/android/skin/window.c b/android/skin/window.c index c1bf23f..9e29a3f 100644 --- a/android/skin/window.c +++ b/android/skin/window.c @@ -1301,15 +1301,9 @@ skin_window_resize( SkinWindow* window ) { char temp[32]; -#ifdef HAVE_SETENV sprintf(temp, "%d,%d", window_x, window_y); setenv("SDL_VIDEO_WINDOW_POS", temp, 1); setenv("SDL_VIDEO_WINDOW_FORCE_VISIBLE", "1", 1); -#else - sprintf(temp,"SDL_VIDEO_WINDOW_POS=%d,%d",window_x,window_y); - putenv(temp); - putenv("SDL_VIDEO_WINDOW_FORCE_VISIBLE=1"); -#endif } flags = SDL_SWSURFACE; diff --git a/android/utils/setenv.c b/android/utils/setenv.c new file mode 100644 index 0000000..916c5f3 --- /dev/null +++ b/android/utils/setenv.c @@ -0,0 +1,18 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#ifdef _WIN32 +int setenv(const char *name, const char *value, int overwrite) +{ + int result = 0; + if (overwrite || !getenv(name)) { + size_t length = strlen(name) + strlen(value) + 2; + char *string = malloc(length); + snprintf(string, length, "%s=%s", name, value); + result = putenv(string); + } + return result; +} + +#endif |