mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 08:25:34 +00:00
app: [Android] replace PlatformHandle with JavaVM, AppContext methods
Clearer and fewer types. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -61,6 +61,8 @@ var dataDirChan = make(chan string, 1)
|
||||
|
||||
var theJVM *C.JavaVM
|
||||
|
||||
var appContext C.jobject
|
||||
|
||||
var views = make(map[C.jlong]*window)
|
||||
|
||||
var mainWindow = newWindowRendezvous()
|
||||
@@ -91,15 +93,19 @@ func runGoMain(env *C.JNIEnv, class C.jclass, jdataDir C.jbyteArray, context C.j
|
||||
dataDir := C.GoStringN((*C.char)(unsafe.Pointer(dirBytes)), n)
|
||||
dataDirChan <- dataDir
|
||||
C.gio_jni_ReleaseByteArrayElements(env, jdataDir, dirBytes)
|
||||
context = C.gio_jni_NewGlobalRef(env, context)
|
||||
appContext = C.gio_jni_NewGlobalRef(env, context)
|
||||
|
||||
PlatformHandle = &Handle{
|
||||
JVM: uintptr(unsafe.Pointer(theJVM)),
|
||||
Context: uintptr(context),
|
||||
}
|
||||
runMain()
|
||||
}
|
||||
|
||||
func JavaVM() uintptr {
|
||||
return uintptr(unsafe.Pointer(theJVM))
|
||||
}
|
||||
|
||||
func AppContext() uintptr {
|
||||
return uintptr(appContext)
|
||||
}
|
||||
|
||||
func GetDataDir() string {
|
||||
return <-dataDirChan
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user