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
diff --git a/gui/action.cpp b/gui/action.cpp
index 9f746c3..656c687 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -292,12 +292,9 @@
int GUIAction::NotifyKey(int key, bool down)
{
- if (mKeys.empty())
- return 0;
-
std::map<int, bool>::iterator itr = mKeys.find(key);
if(itr == mKeys.end())
- return 0;
+ return 1;
bool prevState = itr->second;
itr->second = down;
@@ -312,7 +309,7 @@
} 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::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;