summaryrefslogtreecommitdiffstats
path: root/gui/hardwarekeyboard.cpp
diff options
context:
space:
mode:
authorVojtech Bocek <vbocek@gmail.com>2014-03-13 17:36:52 +0100
committerGerrit Code Review <gerrit2@gerrit>2014-04-16 17:51:17 +0200
commit0b7fe504dc93246957aee38c0d93ea1fa1580fab (patch)
tree77a4471931591355c383074c480b91d8b71840e5 /gui/hardwarekeyboard.cpp
parentAdd additional search path for brightness (diff)
downloadandroid_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar
android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.gz
android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.bz2
android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.lz
android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.xz
android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.zst
android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.zip
Diffstat (limited to 'gui/hardwarekeyboard.cpp')
-rw-r--r--gui/hardwarekeyboard.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/gui/hardwarekeyboard.cpp b/gui/hardwarekeyboard.cpp
index a5a9987ae..f2194938e 100644
--- a/gui/hardwarekeyboard.cpp
+++ b/gui/hardwarekeyboard.cpp
@@ -38,15 +38,22 @@ HardwareKeyboard::~HardwareKeyboard()
int HardwareKeyboard::KeyDown(int key_code)
{
+ mPressedKeys.insert(key_code);
+ PageManager::NotifyKey(key_code, true);
#ifdef _EVENT_LOGGING
LOGERR("HardwareKeyboard::KeyDown %i\n", key_code);
#endif
- PageManager::NotifyKey(key_code);
return 0; // 0 = no key repeat anything else turns on key repeat
}
int HardwareKeyboard::KeyUp(int key_code)
{
+ std::set<int>::iterator itr = mPressedKeys.find(key_code);
+ if(itr != mPressedKeys.end())
+ {
+ mPressedKeys.erase(itr);
+ PageManager::NotifyKey(key_code, false);
+ }
#ifdef _EVENT_LOGGING
LOGERR("HardwareKeyboard::KeyUp %i\n", key_code);
#endif
@@ -55,8 +62,22 @@ int HardwareKeyboard::KeyUp(int key_code)
int HardwareKeyboard::KeyRepeat(void)
{
+ /*
+ * Uncomment when key repeats are sent somewhere.
+ * std::set<int>::iterator itr = mPressedKeys.find(key_code);
+ * if(itr != mPressedKeys.end())
+ * {
+ * Send repeats somewhere, don't remove itr from mPressedKeys
+ * }
+ */
+
#ifdef _EVENT_LOGGING
LOGERR("HardwareKeyboard::KeyRepeat\n");
#endif
return 0;
}
+
+void HardwareKeyboard::ConsumeKeyRelease(int key)
+{
+ mPressedKeys.erase(key);
+}