summaryrefslogtreecommitdiff
path: root/native/android/input.cpp
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-07-15 17:44:53 -0700
committerDianne Hackborn <hackbod@google.com>2010-07-15 22:05:33 -0700
commit2c6081ce3593712f30dacd990a97209c791d6ced (patch)
tree4808bc521c207ea11ec0daceb98f77a6b47b00a0 /native/android/input.cpp
parentc5ed5910c9ef066cec6a13bbb404ec57b1e92637 (diff)
Implement native key pre-dispatching to IMEs.
This significantly re-works the native key dispatching code to allow events to be pre-dispatched to the current IME before being processed by native code. It introduces one new public API, which must be called after retrieving an event if the app wishes for it to be pre-dispatched. Currently the native code will only do pre-dispatching of system keys, to avoid significant overhead for gaming input. This should be improved to be smarted, filtering for only keys that the IME is interested in. Unfortunately IMEs don't currently provide this information. :p Change-Id: Ic1c7aeec8b348164957f2cd88119eb5bd85c2a9f
Diffstat (limited to 'native/android/input.cpp')
-rw-r--r--native/android/input.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/native/android/input.cpp b/native/android/input.cpp
index 4e1b6dcb042d..59bf71178f7c 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -248,7 +248,7 @@ void AInputQueue_detachLooper(AInputQueue* queue) {
queue->detachLooper();
}
-int AInputQueue_hasEvents(AInputQueue* queue) {
+int32_t AInputQueue_hasEvents(AInputQueue* queue) {
return queue->hasEvents();
}
@@ -256,6 +256,10 @@ int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent) {
return queue->getEvent(outEvent);
}
+int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event) {
+ return queue->preDispatchEvent(event) ? 1 : 0;
+}
+
void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled) {
queue->finishEvent(event, handled != 0);
}