diff options
| author | 2011-04-29 10:24:03 -0700 | |
|---|---|---|
| committer | 2011-04-29 10:24:03 -0700 | |
| commit | 78240a910ddd8ab2080a0cb7d4541c61d4073da8 (patch) | |
| tree | 1299f1ed49c8d583cd82c92af2b30788ba929c81 | |
| parent | 078c9c8851ffaf66b63ba9a6a5d319f41891be75 (diff) | |
| parent | ae9331ec903dc4260cf77e0a99bd2eea849ff718 (diff) | |
am 8ebf3558: Merge "Implement support for ALT and SHIFT modifiers"
* commit '8ebf35589dd2bee84ad93613df21666b8858a10f':
Implement support for ALT and SHIFT modifiers
| -rw-r--r-- | libs/ui/InputDispatcher.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index 46baf9d14f..c0872e52c2 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -37,7 +37,9 @@ // Log debug messages about the app switch latency optimization. #define DEBUG_APP_SWITCH 0 +#include <android/input.h> #include <cutils/log.h> +#include <ui/Input.h> #include <ui/InputDispatcher.h> #include <ui/PowerManager.h> @@ -2094,6 +2096,26 @@ void InputDispatcher::notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t sou return; } + /* According to http://source.android.com/porting/keymaps_keyboard_input.html + * Key definitions: Key definitions follow the syntax key SCANCODE KEYCODE [FLAGS...], + * where SCANCODE is a number, KEYCODE is defined in your specific keylayout file + * (android.keylayout.xxx), and potential FLAGS are defined as follows: + * SHIFT: While pressed, the shift key modifier is set + * ALT: While pressed, the alt key modifier is set + * CAPS: While pressed, the caps lock key modifier is set + * Since KeyEvent.java doesn't check if Cap lock is ON and we don't have a + * modifer state for cap lock, we will not support it. + */ + if (policyFlags & POLICY_FLAG_ALT) { + metaState |= AMETA_ALT_ON | AMETA_ALT_LEFT_ON; + } + if (policyFlags & POLICY_FLAG_ALT_GR) { + metaState |= AMETA_ALT_ON | AMETA_ALT_RIGHT_ON; + } + if (policyFlags & POLICY_FLAG_SHIFT) { + metaState |= AMETA_SHIFT_ON | AMETA_SHIFT_LEFT_ON; + } + policyFlags |= POLICY_FLAG_TRUSTED; mPolicy->interceptKeyBeforeQueueing(eventTime, deviceId, action, /*byref*/ flags, keyCode, scanCode, /*byref*/ policyFlags); |