From 72e0f24c096c9b9cde4141fe2ce4fdf28d4fc000 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Wed, 8 Aug 2018 10:43:45 +0200 Subject: [PATCH] sdl: don't prevent screensaver to systems to suspend properly --- src/anbox/platform/sdl/platform.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/anbox/platform/sdl/platform.cpp b/src/anbox/platform/sdl/platform.cpp index 3997720..e3ead81 100644 --- a/src/anbox/platform/sdl/platform.cpp +++ b/src/anbox/platform/sdl/platform.cpp @@ -42,6 +42,13 @@ Platform::Platform( : input_manager_(input_manager), event_thread_running_(false), single_window_(single_window) { + + // Don't block the screensaver from kicking in. It will be blocked + // by the desktop shell already and we don't have to do this again. + // If we would leave this enabled it will prevent systems from + // suspending correctly. + SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1"); + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0) { const auto message = utils::string_format("Failed to initialize SDL: %s", SDL_GetError()); BOOST_THROW_EXCEPTION(std::runtime_error(message));