app: [iOS] implement ViewEvent

ViewEvent exposes native window handle for platform specific uses. This
change implements ViewEvent for iOS.

Fixes gio#305

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
Inkeliz
2021-11-05 15:49:51 +00:00
committed by Elias Naur
parent 9d05f35341
commit 40bc2e1f88
+6 -1
View File
@@ -86,7 +86,10 @@ import (
"gioui.org/unit"
)
type ViewEvent struct{}
type ViewEvent struct {
// View is a CFTypeRef for the UIView backing a Window.
View uintptr
}
type window struct {
view C.CFTypeRef
@@ -125,6 +128,7 @@ func onCreate(view C.CFTypeRef) {
w.w.SetDriver(w)
views[view] = w
w.w.Event(system.StageEvent{Stage: system.StagePaused})
w.w.Event(ViewEvent{View: uintptr(view)})
}
//export gio_onDraw
@@ -177,6 +181,7 @@ func onStop(view C.CFTypeRef) {
func onDestroy(view C.CFTypeRef) {
w := views[view]
delete(views, view)
w.w.Event(ViewEvent{})
w.w.Event(system.DestroyEvent{})
w.displayLink.Close()
w.view = 0