From 8d4a69cacf9595546089b2b538bc88e81c6141d0 Mon Sep 17 00:00:00 2001 From: hex007 Date: Thu, 21 Sep 2017 10:44:00 -0700 Subject: [PATCH] Handle longclick in PS:Instant mode --- es-core/src/components/IList.h | 3 +++ es-core/src/guis/GuiDetectDevice.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/es-core/src/components/IList.h b/es-core/src/components/IList.h index 5543fae06..41dcfc0a2 100644 --- a/es-core/src/components/IList.h +++ b/es-core/src/components/IList.h @@ -7,6 +7,7 @@ #include "components/ImageComponent.h" #include "resources/Font.h" #include "Renderer.h" +#include "PowerSaver.h" enum CursorState { @@ -191,6 +192,8 @@ protected: bool listInput(int velocity) // a velocity of 0 = stop scrolling { + PowerSaver::setState(velocity == 0); + // generate an onCursorChanged event in the stopped state when the user lets go of the key if(velocity == 0 && mScrollVelocity != 0) onCursorChanged(CURSOR_STOPPED); diff --git a/es-core/src/guis/GuiDetectDevice.cpp b/es-core/src/guis/GuiDetectDevice.cpp index bf8e8e4cb..b883885c1 100644 --- a/es-core/src/guis/GuiDetectDevice.cpp +++ b/es-core/src/guis/GuiDetectDevice.cpp @@ -1,6 +1,7 @@ #include "guis/GuiDetectDevice.h" #include "Window.h" #include "Renderer.h" +#include "PowerSaver.h" #include "resources/Font.h" #include "guis/GuiInputConfig.h" #include "components/TextComponent.h" @@ -74,9 +75,12 @@ void GuiDetectDevice::onSizeChanged() bool GuiDetectDevice::input(InputConfig* config, Input input) { + PowerSaver::pause(); + if(!mFirstRun && input.device == DEVICE_KEYBOARD && input.type == TYPE_KEY && input.value && input.id == SDLK_ESCAPE) { // cancel configuring + PowerSaver::resume(); delete this; return true; } @@ -109,6 +113,7 @@ void GuiDetectDevice::update(int deltaTime) { if(mDoneCallback) mDoneCallback(); + PowerSaver::resume(); delete this; // delete GUI element } else @@ -121,6 +126,7 @@ void GuiDetectDevice::update(int deltaTime) { // picked one! mWindow->pushGui(new GuiInputConfig(mWindow, mHoldingConfig, true, mDoneCallback)); + PowerSaver::resume(); delete this; } }