Skip to content

Commit

Permalink
[ScreenSaver] Consume input on cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
placroix74 committed Apr 7, 2019
1 parent f7af835 commit 9362967
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions es-core/src/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ void Window::input(InputConfig* config, Input input)
mSleeping = true;
}
}
/*else if(input.value != 0)
{
return;
}*/
}
}

Expand All @@ -157,7 +153,8 @@ void Window::input(InputConfig* config, Input input)
}

mTimeSinceLastInput = 0;
cancelScreenSaver();
if (cancelScreenSaver())
return;

if(config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_g && SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug"))
{
Expand Down Expand Up @@ -426,7 +423,7 @@ void Window::startScreenSaver()
}
}

void Window::cancelScreenSaver()
bool Window::cancelScreenSaver()
{
if (mScreenSaver && mRenderScreenSaver)
{
Expand All @@ -437,7 +434,11 @@ void Window::cancelScreenSaver()
// Tell the GUI components the screensaver has stopped
for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++)
(*i)->onScreenSaverDeactivate();

return true;
}

return false;
}

void Window::renderScreenSaver()
Expand Down
2 changes: 1 addition & 1 deletion es-core/src/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Window
inline void stopInfoPopup() { if (mInfoPopup) mInfoPopup->stop(); };

void startScreenSaver();
void cancelScreenSaver();
bool cancelScreenSaver();
void renderScreenSaver();

private:
Expand Down

0 comments on commit 9362967

Please sign in to comment.