From 40bc2e1f88b8983d661f4b80bc0f80b80dc13f2d Mon Sep 17 00:00:00 2001 From: Inkeliz Date: Fri, 5 Nov 2021 15:49:51 +0000 Subject: [PATCH] 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 --- app/os_ios.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/os_ios.go b/app/os_ios.go index 2939b3b0..cb18f53f 100644 --- a/app/os_ios.go +++ b/app/os_ios.go @@ -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