1
0
mirror of https://github.com/simh/simh.git synced 2026-01-13 15:27:14 +00:00

VIDEO: Provide a user configurable option to enable the screen saver

The environment variable SDL_VIDEO_ALLOW_SCREENSAVER can override the
default that disables the OS screen saver if a video window is displayed
by the simulator.

sim> set env SDL_VIDEO_ALLOW_SCREENSAVER=1
This commit is contained in:
Mark Pizzolato 2022-07-19 05:47:44 -10:00
parent 69a92622be
commit 252f674fc8

View File

@ -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");