From 8834a0ffc0be61218ab86bf209cb6cd53a18a565 Mon Sep 17 00:00:00 2001 From: that Date: Tue, 5 Jan 2016 23:29:30 +0100 Subject: gui: add keyboard support for Ctrl layer and more special keys - rename NotifyKeyboard to NotifyCharInput - input: handle arrow keys in NotifyKey with standard KEY_* codes - fix page handler to return 0 from NotifyKey if key was handled - fix GUIAction::NotifyKey to not swallow all keys - change home button code from KEY_HOME to KEY_HOMEPAGE (to avoid collision with Home/End, conforms to Android 3.0+) Change-Id: Ib138afa492df8d0c1975415e8b5334c8778ccc90 --- gui/action.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gui/action.cpp') diff --git a/gui/action.cpp b/gui/action.cpp index 9f746c348..656c687b9 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -292,12 +292,9 @@ int GUIAction::NotifyTouch(TOUCH_STATE state __unused, int x __unused, int y __u int GUIAction::NotifyKey(int key, bool down) { - if (mKeys.empty()) - return 0; - std::map::iterator itr = mKeys.find(key); if(itr == mKeys.end()) - return 0; + return 1; bool prevState = itr->second; itr->second = down; @@ -312,7 +309,7 @@ int GUIAction::NotifyKey(int key, bool down) } else if(down) { for(itr = mKeys.begin(); itr != mKeys.end(); ++itr) { if(!itr->second) - return 0; + return 1; } // Passed, all req buttons are pressed, reset them and consume release events @@ -1727,7 +1724,7 @@ int GUIAction::twcmd(std::string arg) int GUIAction::getKeyByName(std::string key) { - if (key == "home") return KEY_HOME; + if (key == "home") return KEY_HOMEPAGE; // note: KEY_HOME is cursor movement (like KEY_END) else if (key == "menu") return KEY_MENU; else if (key == "back") return KEY_BACK; else if (key == "search") return KEY_SEARCH; -- cgit v1.2.3