You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
android_os_MessageQueue: move looper prototypes to header, fix incorrect prototype
This commit is contained in:
@@ -7,15 +7,9 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "../libandroid/looper.h"
|
||||
#include "generated_headers/android_os_MessageQueue.h"
|
||||
|
||||
/* TODO put these in a header */
|
||||
typedef void ALooper;
|
||||
ALooper * ALooper_prepare(void);
|
||||
void ALooper_wake(ALooper *looper);
|
||||
bool ALooper_isPolling(ALooper *looper);
|
||||
int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
|
||||
|
||||
struct native_message_queue {
|
||||
ALooper *looper;
|
||||
bool in_callback;
|
||||
@@ -40,7 +34,7 @@ JNIEXPORT jlong JNICALL Java_android_os_MessageQueue_nativeInit(JNIEnv *env, jcl
|
||||
struct native_message_queue *message_queue = malloc(sizeof(struct native_message_queue));
|
||||
|
||||
message_queue->in_callback = false;
|
||||
message_queue->looper = ALooper_prepare();
|
||||
message_queue->looper = ALooper_prepare(0);
|
||||
message_queue->is_main_thread = g_thread_self() == main_thread_id;
|
||||
|
||||
return _INTPTR(message_queue);
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef void ALooper;
|
||||
#include "looper.h"
|
||||
|
||||
typedef int (*Looper_callbackFunc)(int fd, int events, void* data);
|
||||
|
||||
// dummy strong pointer class
|
||||
|
||||
10
src/libandroid/looper.h
Normal file
10
src/libandroid/looper.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef LOOPER_H
|
||||
#define LOOPER_H
|
||||
|
||||
typedef void ALooper;
|
||||
ALooper * ALooper_prepare(int opts);
|
||||
void ALooper_wake(ALooper *looper);
|
||||
bool ALooper_isPolling(ALooper *looper);
|
||||
int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user