Skip to content
Snippets Groups Projects
Commit 6dd8e2a8 authored by Oliver Behnke's avatar Oliver Behnke
Browse files

Set screensaver hint before video initialization

* Avoids changing the mode from the default to the disired state
* Doesn't trigger powerd on macOS (no issue, just optimizing)
parent 98b883dd
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,9 @@ WindowManager::~WindowManager()
bool WindowManager::initialize(const int width, const int height, const int frameRate)
{
// allow screensaver (or we might block BOINC's own, our parent)
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
cerr << "Window system could not be initalized: " << SDL_GetError() << endl;
return false;
......@@ -44,12 +47,6 @@ 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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment