summaryrefslogtreecommitdiffstats
path: root/native/include/android
diff options
context:
space:
mode:
Diffstat (limited to 'native/include/android')
-rw-r--r--native/include/android/input.h36
-rw-r--r--native/include/android/native_activity.h15
2 files changed, 51 insertions, 0 deletions
diff --git a/native/include/android/input.h b/native/include/android/input.h
index 193cbf3..2441af0 100644
--- a/native/include/android/input.h
+++ b/native/include/android/input.h
@@ -523,6 +523,42 @@ float motion_event_get_historical_pressure(input_event_t* motion_event, size_t p
float motion_event_get_historical_size(input_event_t* motion_event, size_t pointer_index,
size_t history_index);
+/*
+ * Input queue
+ *
+ * An input queue is the facility through which you retrieve input
+ * events.
+ */
+struct input_queue_t;
+typedef struct input_queue_t input_queue_t;
+
+/*
+ * Return a file descriptor for the queue, which you
+ * can use to determine if there are events available. This
+ * is typically used with select() or poll() to multiplex
+ * with other kinds of events.
+ */
+int input_queue_get_fd(input_queue_t* queue);
+
+/*
+ * Returns true if there are one or more events available in the
+ * input queue. Returns 1 if the queue has events; 0 if
+ * it does not have events; and a negative value if there is an error.
+ */
+int input_queue_has_events(input_queue_t* queue);
+
+/*
+ * Returns the next available event from the queue. Returns a negative
+ * value if no events are available or an error has occurred.
+ */
+int32_t input_queue_get_event(input_queue_t* queue, input_event_t** outEvent);
+
+/*
+ * Report that dispatching has finished with the given event.
+ * This must be called after receiving an event with input_queue_get_event().
+ */
+void input_queue_finish_event(input_queue_t* queue, input_event_t* event, int handled);
+
#ifdef __cplusplus
}
#endif
diff --git a/native/include/android/native_activity.h b/native/include/android/native_activity.h
index 328a4b5..a58a7d2 100644
--- a/native/include/android/native_activity.h
+++ b/native/include/android/native_activity.h
@@ -23,6 +23,8 @@
#include <jni.h>
+#include <android/input.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -144,6 +146,19 @@ typedef struct android_activity_callbacks_t {
* returning from here.
*/
void (*onSurfaceDestroyed)(android_activity_t* activity, android_surface_t* surface);
+
+ /**
+ * The input queue for this native activity's window has been created.
+ * You can use the given input queue to start retrieving input events.
+ */
+ void (*onInputQueueCreated)(android_activity_t* activity, input_queue_t* queue);
+
+ /**
+ * The input queue for this native activity's window is being destroyed.
+ * You should no longer try to reference this object upon returning from this
+ * function.
+ */
+ void (*onInputQueueDestroyed)(android_activity_t* activity, input_queue_t* queue);
/**
* The system is running low on memory. Use this callback to release