diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-12-06 17:13:33 -0800 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2010-12-07 17:35:26 -0800 |
commit | 49ed71db425c5054e3ad9526496a7e116c89556b (patch) | |
tree | 3d3b28bdaf76d5cc531fd3b52fcbb0efb32a05ba /include/ui/InputDispatcher.h | |
parent | f30c8287525ac049d4d7589a330be5713256046b (diff) | |
download | frameworks_base-49ed71db425c5054e3ad9526496a7e116c89556b.zip frameworks_base-49ed71db425c5054e3ad9526496a7e116c89556b.tar.gz frameworks_base-49ed71db425c5054e3ad9526496a7e116c89556b.tar.bz2 |
Add support for fallback keycodes.
This change enables the framework to synthesize key events to implement
default behavior when an application does not handle a key.
For example, this change enables numeric keypad keys to perform
their associated special function when numlock is off.
The application is informed that it is processing a fallback keypress
so it can choose to ignore it.
Added a new keycode for switching applications.
Added ALT key deadkeys.
New default key mappings:
- ESC -> BACK
- Meta+ESC -> HOME
- Alt+ESC -> MENU
- Meta+Space -> SEARCH
- Meta+Tab -> APP_SWITCH
Fixed some comments.
Fixed some tests.
Change-Id: Id7f3b6645f3a350275e624547822f72652f3defe
Diffstat (limited to 'include/ui/InputDispatcher.h')
-rw-r--r-- | include/ui/InputDispatcher.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h index b621680..7305601 100644 --- a/include/ui/InputDispatcher.h +++ b/include/ui/InputDispatcher.h @@ -306,9 +306,10 @@ public: virtual bool interceptKeyBeforeDispatching(const sp<InputChannel>& inputChannel, const KeyEvent* keyEvent, uint32_t policyFlags) = 0; - /* Allows the policy a chance to perform default processing for an unhandled key. */ + /* Allows the policy a chance to perform default processing for an unhandled key. + * Returns an alternate keycode to redispatch as a fallback, or 0 to give up. */ virtual bool dispatchUnhandledKey(const sp<InputChannel>& inputChannel, - const KeyEvent* keyEvent, uint32_t policyFlags) = 0; + const KeyEvent* keyEvent, uint32_t policyFlags, KeyEvent* outFallbackKeyEvent) = 0; /* Notifies the policy about switch events. */ @@ -735,6 +736,7 @@ private: CANCEL_ALL_EVENTS = 0, CANCEL_POINTER_EVENTS = 1, CANCEL_NON_POINTER_EVENTS = 2, + CANCEL_FALLBACK_EVENTS = 3, }; InputState(); @@ -771,6 +773,7 @@ private: int32_t source; int32_t keyCode; int32_t scanCode; + int32_t flags; nsecs_t downTime; }; @@ -790,7 +793,10 @@ private: Vector<KeyMemento> mKeyMementos; Vector<MotionMemento> mMotionMementos; - static bool shouldCancelEvent(int32_t eventSource, CancelationOptions options); + static bool shouldCancelKey(const KeyMemento& memento, + CancelationOptions options); + static bool shouldCancelMotion(const MotionMemento& memento, + CancelationOptions options); }; /* Manages the dispatch state associated with a single input channel. */ |