Merge pull request #852 from morphis/dont-disable-screensaver
sdl: don't prevent screensaver to systems to suspend properly
This commit is contained in:
commit
ad128b32d4
1 changed files with 7 additions and 0 deletions
|
|
@ -42,6 +42,13 @@ Platform::Platform(
|
||||||
: input_manager_(input_manager),
|
: input_manager_(input_manager),
|
||||||
event_thread_running_(false),
|
event_thread_running_(false),
|
||||||
single_window_(single_window) {
|
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) {
|
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());
|
const auto message = utils::string_format("Failed to initialize SDL: %s", SDL_GetError());
|
||||||
BOOST_THROW_EXCEPTION(std::runtime_error(message));
|
BOOST_THROW_EXCEPTION(std::runtime_error(message));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue