summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-04-10 21:12:00 -0700
committerMichael Wright <michaelwr@google.com>2013-04-22 17:01:51 -0700
commita44dd26a75e24cc021802288fb81f4761e47be6b (patch)
treece61491d8a35cc7a61af5597f6709b3c92504a54 /native
parentc3d0a81a4a1809446bc1fa9abc9b5b74b01e676e (diff)
downloadframeworks_base-a44dd26a75e24cc021802288fb81f4761e47be6b.zip
frameworks_base-a44dd26a75e24cc021802288fb81f4761e47be6b.tar.gz
frameworks_base-a44dd26a75e24cc021802288fb81f4761e47be6b.tar.bz2
Rewrite input handling for native applications
Bug: 8473020 Change-Id: Ic4353d8924ab877bec21aff8c2dba9fe725bf906
Diffstat (limited to 'native')
-rw-r--r--native/android/input.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/native/android/input.cpp b/native/android/input.cpp
index accec64..7ac73c7 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -25,12 +25,15 @@
#include <utils/Vector.h>
#include <android_runtime/android_app_NativeActivity.h>
+#include <android_runtime/android_view_InputQueue.h>
#include <poll.h>
#include <errno.h>
using android::InputEvent;
+using android::InputQueue;
using android::KeyEvent;
+using android::Looper;
using android::MotionEvent;
using android::sp;
using android::Vector;
@@ -269,25 +272,37 @@ float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
int ident, ALooper_callbackFunc callback, void* data) {
- queue->attachLooper(looper, ident, callback, data);
+ InputQueue* iq = static_cast<InputQueue*>(queue);
+ Looper* l = static_cast<Looper*>(looper);
+ iq->attachLooper(l, ident, callback, data);
}
void AInputQueue_detachLooper(AInputQueue* queue) {
- queue->detachLooper();
+ InputQueue* iq = static_cast<InputQueue*>(queue);
+ iq->detachLooper();
}
int32_t AInputQueue_hasEvents(AInputQueue* queue) {
- return queue->hasEvents();
+ InputQueue* iq = static_cast<InputQueue*>(queue);
+ return iq->hasEvents();
}
int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent) {
- return queue->getEvent(outEvent);
+ InputQueue* iq = static_cast<InputQueue*>(queue);
+ InputEvent* event;
+ int32_t res = iq->getEvent(&event);
+ *outEvent = event;
+ return res;
}
int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event) {
- return queue->preDispatchEvent(event) ? 1 : 0;
+ InputQueue* iq = static_cast<InputQueue*>(queue);
+ InputEvent* e = static_cast<InputEvent*>(event);
+ return iq->preDispatchEvent(e) ? 1 : 0;
}
void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled) {
- queue->finishEvent(event, handled != 0, false);
+ InputQueue* iq = static_cast<InputQueue*>(queue);
+ InputEvent* e = static_cast<InputEvent*>(event);
+ iq->finishEvent(e, handled != 0);
}