From f7af8357f8e64d0333cad32588d47034b0438d63 Mon Sep 17 00:00:00 2001 From: placroix74 Date: Sun, 7 Apr 2019 08:52:36 -0400 Subject: [PATCH 1/2] Code formatting --- es-core/src/Window.cpp | 54 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 2716792a0..95e0713c9 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -414,34 +414,34 @@ bool Window::isProcessing() } void Window::startScreenSaver() - { - if (mScreenSaver && !mRenderScreenSaver) - { - // Tell the GUI components the screensaver is starting - for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++) - (*i)->onScreenSaverActivate(); +{ + if (mScreenSaver && !mRenderScreenSaver) + { + // Tell the GUI components the screensaver is starting + for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++) + (*i)->onScreenSaverActivate(); - mScreenSaver->startScreenSaver(); - mRenderScreenSaver = true; - } - } + mScreenSaver->startScreenSaver(); + mRenderScreenSaver = true; + } +} - void Window::cancelScreenSaver() - { - if (mScreenSaver && mRenderScreenSaver) - { - mScreenSaver->stopScreenSaver(); - mRenderScreenSaver = false; - mScreenSaver->resetCounts(); +void Window::cancelScreenSaver() +{ + if (mScreenSaver && mRenderScreenSaver) + { + mScreenSaver->stopScreenSaver(); + mRenderScreenSaver = false; + mScreenSaver->resetCounts(); - // Tell the GUI components the screensaver has stopped - for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++) - (*i)->onScreenSaverDeactivate(); - } - } + // Tell the GUI components the screensaver has stopped + for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++) + (*i)->onScreenSaverDeactivate(); + } +} - void Window::renderScreenSaver() - { - if (mScreenSaver) - mScreenSaver->renderScreenSaver(); - } +void Window::renderScreenSaver() +{ + if (mScreenSaver) + mScreenSaver->renderScreenSaver(); +} From 93629678801562375bd67fc70b8795d4198f5f05 Mon Sep 17 00:00:00 2001 From: placroix74 Date: Sun, 7 Apr 2019 08:54:06 -0400 Subject: [PATCH 2/2] [ScreenSaver] Consume input on cancel --- es-core/src/Window.cpp | 13 +++++++------ es-core/src/Window.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 95e0713c9..d197b8615 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -139,10 +139,6 @@ void Window::input(InputConfig* config, Input input) mSleeping = true; } } - /*else if(input.value != 0) - { - return; - }*/ } } @@ -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")) { @@ -426,7 +423,7 @@ void Window::startScreenSaver() } } -void Window::cancelScreenSaver() +bool Window::cancelScreenSaver() { if (mScreenSaver && mRenderScreenSaver) { @@ -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() diff --git a/es-core/src/Window.h b/es-core/src/Window.h index 738dcda98..3f104c648 100644 --- a/es-core/src/Window.h +++ b/es-core/src/Window.h @@ -74,7 +74,7 @@ public: inline void stopInfoPopup() { if (mInfoPopup) mInfoPopup->stop(); }; void startScreenSaver(); - void cancelScreenSaver(); + bool cancelScreenSaver(); void renderScreenSaver(); private: