diff mbox

sdl: fix setenv for win32

Message ID AANLkTikrfTMRjYTSDg-IAvN_pF6cdlbUd4SN08wuFAeO@mail.gmail.com
State New
Headers show

Commit Message

TeLeMan May 25, 2010, 2:23 a.m. UTC
setenv() is not implemented on MinGW, so we have to use putenv().

Signed-off-by: TeLeMan <geleman@gmail.com>
---
 sdl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

     flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;

Comments

Jan Kiszka May 25, 2010, 6:20 a.m. UTC | #1
TeLeMan wrote:
> setenv() is not implemented on MinGW, so we have to use putenv().

What a ... pity.

> 
> Signed-off-by: TeLeMan <geleman@gmail.com>
> ---
>  sdl.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/sdl.c b/sdl.c
> index add1148..eb4a87f 100644
> --- a/sdl.c
> +++ b/sdl.c
> @@ -850,7 +850,11 @@ void sdl_display_init(DisplayState *ds, int
> full_screen, int no_frame)
>          gui_noframe = 1;
> 
>      if (!full_screen) {
> +#ifdef _WIN32
> +        putenv("SDL_VIDEO_ALLOW_SCREENSAVER=1");

This is not equivalent, the user will no longer be able to control the
value by setting it before starting qemu.

Let's check for the existence of SDL_VIDEO_ALLOW_SCREENSAVER first, set
it if it's not yet there, and do this for all platforms, leaving a
comment about the WIN32 dependency behind.

Jan

> +#else
>          setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
> +#endif
>      }
> 
>      flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
diff mbox

Patch

diff --git a/sdl.c b/sdl.c
index add1148..eb4a87f 100644
--- a/sdl.c
+++ b/sdl.c
@@ -850,7 +850,11 @@  void sdl_display_init(DisplayState *ds, int
full_screen, int no_frame)
         gui_noframe = 1;

     if (!full_screen) {
+#ifdef _WIN32
+        putenv("SDL_VIDEO_ALLOW_SCREENSAVER=1");
+#else
         setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
+#endif
     }