mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 02:52:30 +02:00
Merge pull request #3008 from Lionel07/qt-screensaver
Qt: Disable Display Sleep when game is running (Windows)
This commit is contained in:
commit
ee7285a1db
@ -138,11 +138,27 @@ void DMainWindow::StartGame(const QString filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Disable screensaver!
|
||||
DisableScreensaver();
|
||||
emit CoreStateChanged(Core::CORE_RUN);
|
||||
}
|
||||
}
|
||||
|
||||
void DMainWindow::DisableScreensaver()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// Prevents Windows from sleeping or turning off the display
|
||||
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DMainWindow::EnableScreensaver()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// Allows Windows to sleep and turn off the display
|
||||
SetThreadExecutionState(ES_CONTINUOUS);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString DMainWindow::RequestBootFilename()
|
||||
{
|
||||
// If a game is already selected, just return the filename
|
||||
@ -263,8 +279,7 @@ bool DMainWindow::Stop()
|
||||
// TODO: Show the author/description dialog here
|
||||
|
||||
BootManager::Stop();
|
||||
|
||||
// TODO: Allow screensaver again
|
||||
EnableScreensaver();
|
||||
// TODO: Restore original window title
|
||||
|
||||
// TODO:
|
||||
|
@ -68,6 +68,9 @@ private:
|
||||
std::unique_ptr<Ui::DMainWindow> m_ui;
|
||||
DGameTracker* m_game_tracker;
|
||||
|
||||
// Misc.
|
||||
void DisableScreensaver();
|
||||
void EnableScreensaver();
|
||||
// Emulation
|
||||
QString RequestBootFilename();
|
||||
QString ShowFileDialog();
|
||||
|
Loading…
Reference in New Issue
Block a user