From d4725ca147b3ac32c8a4e66bb75727e597a2ee14 Mon Sep 17 00:00:00 2001 From: that Date: Tue, 19 Jan 2016 00:15:21 +0100 Subject: gui: fix return value of NotifyKey Only the last action got its keys and ate all of them (om nom nom). This fixes the power button action that activates the lock screen. Change-Id: Ia724568b159090c2c14a282cf3927915b2dc70e7 --- gui/action.cpp | 7 +++++-- gui/terminal.cpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gui/action.cpp b/gui/action.cpp index 81c6294e2..1b30a2064 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -304,8 +304,10 @@ int GUIAction::NotifyKey(int key, bool down) // Else, check if all buttons are pressed, then consume their release events // so they don't trigger one-button actions and reset mKeys pressed status if(mKeys.size() == 1) { - if(!down && prevState) + if(!down && prevState) { doActions(); + return 0; + } } else if(down) { for(itr = mKeys.begin(); itr != mKeys.end(); ++itr) { if(!itr->second) @@ -320,9 +322,10 @@ int GUIAction::NotifyKey(int key, bool down) } doActions(); + return 0; } - return 0; + return 1; } int GUIAction::NotifyVarChange(const std::string& varName, const std::string& value) diff --git a/gui/terminal.cpp b/gui/terminal.cpp index 00b7820a5..044782e4e 100644 --- a/gui/terminal.cpp +++ b/gui/terminal.cpp @@ -833,6 +833,8 @@ int GUITerminal::NotifyTouch(TOUCH_STATE state, int x, int y) int GUITerminal::NotifyKey(int key, bool down) { + if (!HasInputFocus) + return 1; if (down) if (engine->inputKey(key)) mUpdate = 1; -- cgit v1.2.3