~eliasnaur/gio

22b367cb33bfb613ca5d235f7674dcb24f20357f — Elias Naur 7 days ago ac62e3a
app/internal/window: [Android] don't block in runOnMain

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 6 insertions(+), 4 deletions(-)

M app/internal/window/os_android.go
M app/internal/window/os_android.go => app/internal/window/os_android.go +6 -4
@@ 637,10 637,12 @@ func (w *window) ReadClipboard() {

// runOnMain runs a function on the Java main thread.
func (w *window) runOnMain(f func(env *C.JNIEnv)) {
	mainFuncs <- f
	runInJVM(javaVM(), func(env *C.JNIEnv) {
		callVoidMethod(env, w.view, w.mwakeupMainThread)
	})
	go func() {
		mainFuncs <- f
		runInJVM(javaVM(), func(env *C.JNIEnv) {
			callVoidMethod(env, w.view, w.mwakeupMainThread)
		})
	}()
}

//export Java_org_gioui_GioView_scheduleMainFuncs