add support for the boneheaded method of receiving input events that is used by NativeActivity apps

currently, our "not-actually-a-queue" implementation is quite ugly,
hopefully it might be possible to make it look somewhat sane while
not needing to make it as much of a queue as it is on android
This commit is contained in:
Mis012
2022-11-11 19:18:21 +01:00
parent 231ac88dbd
commit 33b4515cb9
12 changed files with 291 additions and 36 deletions

View File

@@ -0,0 +1,24 @@
package android.view;
public final class InputQueue {
// for now, we will put a GtkEventController for the window here
private long native_ptr = 0;
public long getNativePtr() {
return native_ptr; // FIXME?
}
public static interface Callback {
/**
* Called when the given InputQueue is now associated with the
* thread making this call, so it can start receiving events from it.
*/
void onInputQueueCreated(InputQueue queue);
/**
* Called when the given InputQueue is no longer associated with
* the thread and thus not dispatching events.
*/
void onInputQueueDestroyed(InputQueue queue);
}
}

View File

@@ -33,4 +33,10 @@ public class Window {
}
private native void set_widget_as_root(long native_window, long widget);
public native void take_input_queue(long native_window, InputQueue.Callback callback, InputQueue queue);
public void takeInputQueue(InputQueue.Callback callback) {
take_input_queue(native_window, callback, new InputQueue());
}
}