Add option for preventing display sleep (#5783)

Adds support for preventing the display from sleeping while a game is
running. Supports Windows, Linux (with the org.freedesktop.ScreenSaver
D-Bus service), and macOS.
This commit is contained in:
Alex James 2019-10-12 07:40:47 -05:00 committed by Ivan
parent 07022fd3b6
commit 3ad743ecaa
11 changed files with 118 additions and 16 deletions

View file

@ -2,10 +2,6 @@
#include "PadHandler.h"
#include "pad_thread.h"
#ifdef _WIN32
#include <Windows.h>
#endif
cfg_input g_cfg_input;
PadHandlerBase::PadHandlerBase(pad_handler type) : m_type(type)
@ -621,16 +617,5 @@ void PadHandlerBase::ThreadProc()
get_mapping(device, pad);
get_extended_info(device, pad);
apply_pad_data(device, pad);
#ifdef _WIN32
for (const auto& btn : pad->m_buttons)
{
if (pad->m_buttons[i].m_pressed)
{
SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
break;
}
}
#endif
}
}