Removed the last remnants of the PowerSaver.

This commit is contained in:
Leon Styhre 2022-05-18 21:08:55 +02:00
parent 667ea1a98d
commit 5b63ecb828
4 changed files with 2 additions and 46 deletions

View file

@ -23,10 +23,6 @@ public:
Screensaver(); Screensaver();
virtual ~Screensaver(); virtual ~Screensaver();
virtual bool allowSleep()
{
return ((mVideoScreensaver == nullptr) && (mImageScreensaver == nullptr));
}
virtual bool isScreensaverActive() { return (mState != STATE_INACTIVE); } virtual bool isScreensaverActive() { return (mState != STATE_INACTIVE); }
virtual bool isFallbackScreensaver() { return mFallbackScreensaver; } virtual bool isFallbackScreensaver() { return mFallbackScreensaver; }

View file

@ -461,14 +461,6 @@ void applicationLoop()
} while (SDL_PollEvent(&event)); } 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 curTime = SDL_GetTicks();
int deltaTime = curTime - lastTime; int deltaTime = curTime - lastTime;
lastTime = curTime; lastTime = curTime;

View file

@ -34,8 +34,6 @@ Window::Window() noexcept
, mAverageDeltaTime {10} , mAverageDeltaTime {10}
, mTimeSinceLastInput {0} , mTimeSinceLastInput {0}
, mNormalizeNextUpdate {false} , mNormalizeNextUpdate {false}
, mAllowSleep {true}
, mSleeping {false}
, mRenderScreensaver {false} , mRenderScreensaver {false}
, mRenderMediaViewer {false} , mRenderMediaViewer {false}
, mRenderLaunchScreen {false} , mRenderLaunchScreen {false}
@ -204,29 +202,19 @@ void Window::input(InputConfig* config, Input input)
// Launch game. // Launch game.
stopScreensaver(); stopScreensaver();
mScreensaver->launchGame(); mScreensaver->launchGame();
// To force handling the wake up process. return;
mSleeping = true;
} }
else if (config->isMappedTo("y", input) && input.value != 0) { else if (config->isMappedTo("y", input) && input.value != 0) {
// Jump to the game in its gamelist, but do not launch it. // Jump to the game in its gamelist, but do not launch it.
stopScreensaver(); stopScreensaver();
NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND);
mScreensaver->goToGame(); mScreensaver->goToGame();
// To force handling the wake up process. return;
mSleeping = true;
} }
} }
} }
} }
if (mSleeping) {
// Wake up.
stopScreensaver();
mSleeping = false;
onWake();
return;
}
// Any keypress cancels the screensaver. // Any keypress cancels the screensaver.
if (input.value != 0 && isScreensaverActive()) { if (input.value != 0 && isScreensaverActive()) {
stopScreensaver(); stopScreensaver();
@ -588,16 +576,6 @@ void Window::render()
// or not because it may perform a fade on transition. // or not because it may perform a fade on transition.
renderScreensaver(); renderScreensaver();
if (mTimeSinceLastInput >= screensaverTimer && screensaverTimer != 0) {
if (!isProcessing() && mAllowSleep && (!mScreensaver)) {
// Go to sleep.
if (mSleeping == false) {
mSleeping = true;
onSleep();
}
}
}
if (mRenderMediaViewer) if (mRenderMediaViewer)
mMediaViewer->render(trans); mMediaViewer->render(trans);

View file

@ -36,7 +36,6 @@ public:
class Screensaver class Screensaver
{ {
public: public:
virtual bool allowSleep() = 0;
virtual bool isScreensaverActive() = 0; virtual bool isScreensaverActive() = 0;
virtual bool isFallbackScreensaver() = 0; virtual bool isFallbackScreensaver() = 0;
@ -94,10 +93,6 @@ public:
void normalizeNextUpdate() { mNormalizeNextUpdate = true; } void normalizeNextUpdate() { mNormalizeNextUpdate = true; }
bool getAllowSleep() { return mAllowSleep; }
void setAllowSleep(bool sleep) { mAllowSleep = sleep; }
bool isSleeping() const { return mSleeping; }
void renderLoadingScreen(std::string text); void renderLoadingScreen(std::string text);
// The list scroll overlay is triggered from IList when the highest scrolling tier is reached. // The list scroll overlay is triggered from IList when the highest scrolling tier is reached.
void renderListScrollOverlay(const float opacity, const std::string& text); void renderListScrollOverlay(const float opacity, const std::string& text);
@ -153,9 +148,6 @@ private:
Window() noexcept; Window() noexcept;
~Window(); ~Window();
void onSleep() { Scripting::fireEvent("sleep"); }
void onWake() { Scripting::fireEvent("wake"); }
// Returns true if at least one component on the stack is processing. // Returns true if at least one component on the stack is processing.
bool isProcessing(); bool isProcessing();
@ -185,8 +177,6 @@ private:
unsigned int mTimeSinceLastInput; unsigned int mTimeSinceLastInput;
bool mNormalizeNextUpdate; bool mNormalizeNextUpdate;
bool mAllowSleep;
bool mSleeping;
bool mRenderScreensaver; bool mRenderScreensaver;
bool mRenderMediaViewer; bool mRenderMediaViewer;