From 09093eee6de4a159a70736618d0ddece17ccb36e Mon Sep 17 00:00:00 2001
From: Oliver Behnke <oliver.behnke@aei.mpg.de>
Date: Thu, 19 Nov 2020 17:21:14 +0100
Subject: [PATCH] SDL changed the way how to enable the system's screesaver

* Switching from obsolete configure option to API call
* Since SDL 2.0.2 screensavers are disabled by default!
* https://wiki.libsdl.org/SDL_IsScreenSaverEnabled
---
 build.sh                        | 4 ++--
 src/framework/WindowManager.cpp | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/build.sh b/build.sh
index d13c91f..abb938f 100755
--- a/build.sh
+++ b/build.sh
@@ -331,9 +331,9 @@ build_sdl()
     chmod +x configure >> $LOGFILE 2>&1 || failure
     cd $ROOT/build/sdl || failure
     if [ "$1" == "$TARGET_MAC" ]; then
-        $ROOT/3rdparty/sdl/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes --enable-screensaver=yes --enable-video-x11=no >> $LOGFILE 2>&1 || failure
+        $ROOT/3rdparty/sdl/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes --enable-video-x11=no >> $LOGFILE 2>&1 || failure
     else
-        $ROOT/3rdparty/sdl/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes --enable-screensaver=yes >> $LOGFILE 2>&1 || failure
+        $ROOT/3rdparty/sdl/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes >> $LOGFILE 2>&1 || failure
     fi
     make >> $LOGFILE 2>&1 || failure
     make install >> $LOGFILE 2>&1 || failure
diff --git a/src/framework/WindowManager.cpp b/src/framework/WindowManager.cpp
index 3e8d08e..77799cd 100644
--- a/src/framework/WindowManager.cpp
+++ b/src/framework/WindowManager.cpp
@@ -40,6 +40,12 @@ bool WindowManager::initialize(const int width, const int height, const int fram
 
 	atexit(SDL_Quit);
 
+	// allow screensaver (or we might block BOINC's own, our parent)
+	SDL_EnableScreenSaver();
+	if (SDL_IsScreenSaverEnabled == SDL_FALSE) {
+		cerr << "Screensavers couldn't be enabled! This might break usage as BOINC screensaver..." << endl;
+	}
+
 	// retrieve current video settings (of the primary display)
 	SDL_DisplayMode mode;
 	if (!SDL_GetDesktopDisplayMode(0, &mode)) {
-- 
GitLab