diff --git a/sim_video.c b/sim_video.c index 25762bbb..f4a54dd4 100644 --- a/sim_video.c +++ b/sim_video.c @@ -1964,11 +1964,24 @@ if (!initialized) { eventtypes[SDL_USEREVENT] = "USEREVENT"; /** - * For consistency with behavior since SDL 2.0.2, we disable - * the screen saver when a video display is enabled. + * The SDL_HINT_VIDEO_ALLOW_SCREENSAVER at init time enables + * the screensaver. Once a video window is created, we default + * to being consistent with behavior since SDL 2.0.2 and we disable + * the screen saver. + * + * We allow an environment variable SDL_VIDEO_ALLOW_SCREENSAVER + * to specifically change this to enable the screensaver if the + * value is "1". */ - if (SDL_IsScreenSaverEnabled () == SDL_TRUE) - SDL_DisableScreenSaver (); + if ((getenv ("SDL_VIDEO_ALLOW_SCREENSAVER") == NULL) || + (strcmp (getenv ("SDL_VIDEO_ALLOW_SCREENSAVER"), "1") != 0)) { + if (SDL_IsScreenSaverEnabled () == SDL_TRUE) + SDL_DisableScreenSaver (); + } + else { + if (SDL_IsScreenSaverEnabled () == SDL_FALSE) + SDL_EnableScreenSaver (); + } } sim_debug (SIM_VID_DBG_VIDEO|SIM_VID_DBG_KEY|SIM_VID_DBG_MOUSE, vptr0->vid_dev, "vid_thread() - Starting\n");