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();
virtual ~Screensaver();
virtual bool allowSleep()
{
return ((mVideoScreensaver == nullptr) && (mImageScreensaver == nullptr));
}
virtual bool isScreensaverActive() { return (mState != STATE_INACTIVE); }
virtual bool isFallbackScreensaver() { return mFallbackScreensaver; }

View file

@ -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;

View file

@ -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);

View file

@ -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;