summaryrefslogtreecommitdiffstats
path: root/native/android/input.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'native/android/input.cpp')
-rw-r--r--native/android/input.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/native/android/input.cpp b/native/android/input.cpp
index 8498840..89d53e2 100644
--- a/native/android/input.cpp
+++ b/native/android/input.cpp
@@ -20,6 +20,7 @@
#include <android/input.h>
#include <ui/Input.h>
#include <ui/InputTransport.h>
+#include <utils/PollLoop.h>
#include <poll.h>
@@ -184,8 +185,16 @@ float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_i
pointer_index, history_index);
}
-int AInputQueue_getFd(AInputQueue* queue) {
- return queue->getConsumer().getChannel()->getReceivePipeFd();
+void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
+ ALooper_callbackFunc* callback, void* data) {
+ queue->setPollLoop(static_cast<android::PollLoop*>(looper));
+ ALooper_addFd(looper, queue->getConsumer().getChannel()->getReceivePipeFd(),
+ POLLIN, callback, data);
+}
+
+void AInputQueue_detachLooper(AInputQueue* queue) {
+ queue->getPollLoop()->removeCallback(
+ queue->getConsumer().getChannel()->getReceivePipeFd());
}
int AInputQueue_hasEvents(AInputQueue* queue) {