mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Merge pull request #8613 from jordan-woyak/expose-disable-ss
Config: Expose "DisableScreenSaver" in the UI and default it to true.
This commit is contained in:
@ -737,7 +737,6 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
||||
if (selection)
|
||||
{
|
||||
StartGame(selection->GetFilePath(), ScanForSecondDisc::Yes, savestate_path);
|
||||
EnableScreenSaver(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -745,7 +744,6 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
||||
if (!default_path.isEmpty() && QFile::exists(default_path))
|
||||
{
|
||||
StartGame(default_path, ScanForSecondDisc::Yes, savestate_path);
|
||||
EnableScreenSaver(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -776,7 +774,6 @@ void MainWindow::OnStopComplete()
|
||||
{
|
||||
m_stop_requested = false;
|
||||
HideRenderWidget();
|
||||
EnableScreenSaver(true);
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
if (!m_netplay_dialog->isVisible())
|
||||
Discord::UpdateDiscordPresence();
|
||||
@ -993,13 +990,6 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
|
||||
|
||||
if (Config::Get(Config::MAIN_FULLSCREEN))
|
||||
m_fullscreen_requested = true;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// Prevents Windows from sleeping, turning off the display, or idling
|
||||
EXECUTION_STATE shouldScreenSave =
|
||||
Config::Get(Config::MAIN_DISABLE_SCREENSAVER) ? ES_DISPLAY_REQUIRED : 0;
|
||||
SetThreadExecutionState(ES_CONTINUOUS | shouldScreenSave | ES_SYSTEM_REQUIRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::SetFullScreenResolution(bool fullscreen)
|
||||
@ -1304,6 +1294,10 @@ void MainWindow::NetPlayInit()
|
||||
Discord::InitNetPlayFunctionality(*m_netplay_discord);
|
||||
m_netplay_discord->Start();
|
||||
#endif
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this,
|
||||
&MainWindow::UpdateScreenSaverInhibition);
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
||||
&MainWindow::UpdateScreenSaverInhibition);
|
||||
}
|
||||
|
||||
bool MainWindow::NetPlayJoin()
|
||||
@ -1435,13 +1429,16 @@ void MainWindow::NetPlayQuit()
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::EnableScreenSaver(bool enable)
|
||||
void MainWindow::UpdateScreenSaverInhibition()
|
||||
{
|
||||
const bool inhibit =
|
||||
Config::Get(Config::MAIN_DISABLE_SCREENSAVER) && (Core::GetState() == Core::State::Running);
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
if (GetWindowSystemType() == WindowSystemType::X11)
|
||||
UICommon::EnableScreenSaver(winId(), enable);
|
||||
UICommon::InhibitScreenSaver(winId(), inhibit);
|
||||
#else
|
||||
UICommon::EnableScreenSaver(enable);
|
||||
UICommon::InhibitScreenSaver(inhibit);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ private:
|
||||
|
||||
QStringList PromptFileNames();
|
||||
|
||||
void EnableScreenSaver(bool enable);
|
||||
void UpdateScreenSaverInhibition();
|
||||
|
||||
void OnStopComplete();
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
|
@ -148,12 +148,14 @@ void InterfacePane::CreateUI()
|
||||
new QCheckBox(tr("Download Game Covers from GameTDB.com for Use in Grid Mode"));
|
||||
m_checkbox_show_debugging_ui = new QCheckBox(tr("Show Debugging UI"));
|
||||
m_checkbox_focused_hotkeys = new QCheckBox(tr("Hotkeys Require Window Focus"));
|
||||
m_checkbox_disable_screensaver = new QCheckBox(tr("Inhibit Screensaver During Emulation"));
|
||||
|
||||
groupbox_layout->addWidget(m_checkbox_use_builtin_title_database);
|
||||
groupbox_layout->addWidget(m_checkbox_use_userstyle);
|
||||
groupbox_layout->addWidget(m_checkbox_use_covers);
|
||||
groupbox_layout->addWidget(m_checkbox_show_debugging_ui);
|
||||
groupbox_layout->addWidget(m_checkbox_focused_hotkeys);
|
||||
groupbox_layout->addWidget(m_checkbox_disable_screensaver);
|
||||
}
|
||||
|
||||
void InterfacePane::CreateInGame()
|
||||
@ -185,6 +187,7 @@ void InterfacePane::ConnectLayout()
|
||||
connect(m_checkbox_use_builtin_title_database, &QCheckBox::toggled, this,
|
||||
&InterfacePane::OnSaveConfig);
|
||||
connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
connect(m_checkbox_disable_screensaver, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
||||
connect(m_combobox_theme, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
@ -237,6 +240,7 @@ void InterfacePane::LoadConfig()
|
||||
m_checkbox_use_covers->setChecked(Config::Get(Config::MAIN_USE_GAME_COVERS));
|
||||
m_checkbox_focused_hotkeys->setChecked(Config::Get(Config::MAIN_FOCUSED_HOTKEYS));
|
||||
m_checkbox_hide_mouse->setChecked(Settings::Instance().GetHideCursor());
|
||||
m_checkbox_disable_screensaver->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER));
|
||||
}
|
||||
|
||||
void InterfacePane::OnSaveConfig()
|
||||
@ -280,6 +284,7 @@ void InterfacePane::OnSaveConfig()
|
||||
}
|
||||
|
||||
Config::SetBase(Config::MAIN_FOCUSED_HOTKEYS, m_checkbox_focused_hotkeys->isChecked());
|
||||
Config::SetBase(Config::MAIN_DISABLE_SCREENSAVER, m_checkbox_disable_screensaver->isChecked());
|
||||
|
||||
settings.SaveSettings();
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ private:
|
||||
QCheckBox* m_checkbox_show_debugging_ui;
|
||||
QCheckBox* m_checkbox_focused_hotkeys;
|
||||
QCheckBox* m_checkbox_use_covers;
|
||||
QCheckBox* m_checkbox_disable_screensaver;
|
||||
|
||||
QCheckBox* m_checkbox_confirm_on_stop;
|
||||
QCheckBox* m_checkbox_use_panic_handlers;
|
||||
|
Reference in New Issue
Block a user