summaryrefslogtreecommitdiff
path: root/libs/input/Keyboard.cpp
diff options
context:
space:
mode:
author Dmitry Torokhov <dtor@google.com> 2015-09-17 18:04:50 -0700
committer Dmitry Torokhov <dtor@google.com> 2015-09-29 13:26:30 -0700
commit115f93eeebf7f33b56ed090de70d6e8c733e5d88 (patch)
tree5cfb07f29be5d8a907e903b9ff5304213b73fbb7 /libs/input/Keyboard.cpp
parentce92ce9bef5942435bb49474f0e5e4b29cfc5e97 (diff)
Allow defining replacement key events in keymap
Currently keyboard maps allow to assign character sequences to key events and allow specifying a so-called "fallback" key events that are re-injected into input stream if target application indicates that it was not able to handle the original key event. Unfortunately there is no way to perform substitution before handing the event to applicationis. This change adds a new keymap keyword "replace" that allows users query "replacement" actions for key (if any), with the intent that such replacement happens early in the event handling process. Bug: 24504154 Change-Id: I3e6a2476c856524171df00ad22ff56f2018c1278
Diffstat (limited to 'libs/input/Keyboard.cpp')
-rw-r--r--libs/input/Keyboard.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/input/Keyboard.cpp b/libs/input/Keyboard.cpp
index f4d95077d9..9a01395da1 100644
--- a/libs/input/Keyboard.cpp
+++ b/libs/input/Keyboard.cpp
@@ -176,6 +176,11 @@ static int32_t setEphemeralMetaState(int32_t mask, bool down, int32_t oldMetaSta
~(mask | AMETA_ALT_ON | AMETA_SHIFT_ON | AMETA_CTRL_ON | AMETA_META_ON);
}
+ return normalizeMetaState(newMetaState);
+}
+
+int32_t normalizeMetaState(int32_t oldMetaState) {
+ int32_t newMetaState = oldMetaState;
if (newMetaState & (AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON)) {
newMetaState |= AMETA_ALT_ON;
}