MessageQueue: integrate with glib main loop

Adds a special treatment for the main Looper to not block in java code,
but instead return to glib managed thread loop. Timeouts in the mainloop
are now handled using g_timeout_add_full().

Also defer Activity construction, so that every thing is set up properly
when the constructor runs.
This commit is contained in:
Julian Winkler
2023-08-08 10:16:17 +02:00
parent c6c4e8b3a2
commit 4491de7f63
7 changed files with 80 additions and 29 deletions

View File

@@ -14,7 +14,6 @@ struct handle_cache {
jmethodID onResume;
jmethodID onWindowFocusChanged;
jmethodID onDestroy;
jmethodID set_window;
} apk_main_activity;
struct {
jclass class;
@@ -81,7 +80,9 @@ extern struct handle_cache handle_cache;
const char * attribute_set_get_string(JNIEnv *env, jobject attrs, char *attribute, char *schema);
int attribute_set_get_int(JNIEnv *env, jobject attrs, char *attribute, char *schema, int default_value);
void set_up_handle_cache(JNIEnv *env, char *apk_main_activity_class);
void set_up_handle_cache(JNIEnv *env);
void extract_from_apk(const char *path, const char *target);
void prepare_main_looper(JNIEnv* env);
#endif