diff --git a/es-app/src/Screensaver.h b/es-app/src/Screensaver.h index 609e6d7fb..c2abe53c5 100644 --- a/es-app/src/Screensaver.h +++ b/es-app/src/Screensaver.h @@ -23,10 +23,6 @@ public: Screensaver(); virtual ~Screensaver(); - virtual bool allowSleep() - { - return ((mVideoScreensaver == nullptr) && (mImageScreensaver == nullptr)); - } virtual bool isScreensaverActive() { return (mState != STATE_INACTIVE); } virtual bool isFallbackScreensaver() { return mFallbackScreensaver; } diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index ed25e2b6c..43486da46 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -461,14 +461,6 @@ void applicationLoop() } while (SDL_PollEvent(&event)); } - if (window->isSleeping()) { - lastTime = SDL_GetTicks(); - // This doesn't need to be accurate, we're just giving up - // our CPU time until something wakes us up. - SDL_Delay(1); - return; - } - int curTime = SDL_GetTicks(); int deltaTime = curTime - lastTime; lastTime = curTime; diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 56960d15c..cd6e3824f 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -34,8 +34,6 @@ Window::Window() noexcept , mAverageDeltaTime {10} , mTimeSinceLastInput {0} , mNormalizeNextUpdate {false} - , mAllowSleep {true} - , mSleeping {false} , mRenderScreensaver {false} , mRenderMediaViewer {false} , mRenderLaunchScreen {false} @@ -204,29 +202,19 @@ void Window::input(InputConfig* config, Input input) // Launch game. stopScreensaver(); mScreensaver->launchGame(); - // To force handling the wake up process. - mSleeping = true; + return; } else if (config->isMappedTo("y", input) && input.value != 0) { // Jump to the game in its gamelist, but do not launch it. stopScreensaver(); NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); mScreensaver->goToGame(); - // To force handling the wake up process. - mSleeping = true; + return; } } } } - if (mSleeping) { - // Wake up. - stopScreensaver(); - mSleeping = false; - onWake(); - return; - } - // Any keypress cancels the screensaver. if (input.value != 0 && isScreensaverActive()) { stopScreensaver(); @@ -588,16 +576,6 @@ void Window::render() // or not because it may perform a fade on transition. renderScreensaver(); - if (mTimeSinceLastInput >= screensaverTimer && screensaverTimer != 0) { - if (!isProcessing() && mAllowSleep && (!mScreensaver)) { - // Go to sleep. - if (mSleeping == false) { - mSleeping = true; - onSleep(); - } - } - } - if (mRenderMediaViewer) mMediaViewer->render(trans); diff --git a/es-core/src/Window.h b/es-core/src/Window.h index b81fdc29a..a5db9e336 100644 --- a/es-core/src/Window.h +++ b/es-core/src/Window.h @@ -36,7 +36,6 @@ public: class Screensaver { public: - virtual bool allowSleep() = 0; virtual bool isScreensaverActive() = 0; virtual bool isFallbackScreensaver() = 0; @@ -94,10 +93,6 @@ public: void normalizeNextUpdate() { mNormalizeNextUpdate = true; } - bool getAllowSleep() { return mAllowSleep; } - void setAllowSleep(bool sleep) { mAllowSleep = sleep; } - bool isSleeping() const { return mSleeping; } - void renderLoadingScreen(std::string text); // The list scroll overlay is triggered from IList when the highest scrolling tier is reached. void renderListScrollOverlay(const float opacity, const std::string& text); @@ -153,9 +148,6 @@ private: Window() noexcept; ~Window(); - void onSleep() { Scripting::fireEvent("sleep"); } - void onWake() { Scripting::fireEvent("wake"); } - // Returns true if at least one component on the stack is processing. bool isProcessing(); @@ -185,8 +177,6 @@ private: unsigned int mTimeSinceLastInput; bool mNormalizeNextUpdate; - bool mAllowSleep; - bool mSleeping; bool mRenderScreensaver; bool mRenderMediaViewer;