From e8bb88c2a14788bb34bdd01f1ad39365dd97e0f5 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 22 Oct 2020 13:19:01 -0500 Subject: [PATCH] DolphinQt: Don't call UICommon::InhibitScreenSaver if already in desired state. --- Source/Core/DolphinQt/MainWindow.cpp | 5 +++++ Source/Core/DolphinQt/MainWindow.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 9a82a6bb53..92f57bac47 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1434,6 +1434,11 @@ void MainWindow::UpdateScreenSaverInhibition() const bool inhibit = Config::Get(Config::MAIN_DISABLE_SCREENSAVER) && (Core::GetState() == Core::State::Running); + if (inhibit == m_is_screensaver_inhibited) + return; + + m_is_screensaver_inhibited = inhibit; + #if defined(HAVE_XRANDR) && HAVE_XRANDR if (GetWindowSystemType() == WindowSystemType::X11) UICommon::InhibitScreenSaver(winId(), inhibit); diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index 77fea6839f..8f69bd6c8e 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -204,6 +204,7 @@ private: bool m_stop_requested = false; bool m_exit_requested = false; bool m_fullscreen_requested = false; + bool m_is_screensaver_inhibited = false; int m_state_slot = 1; std::unique_ptr m_pending_boot;