From 2a32ece084f6cd9985eefe25aadd0579c5dd94e6 Mon Sep 17 00:00:00 2001 From: Inkeliz Date: Wed, 8 Dec 2021 15:15:43 +0000 Subject: [PATCH] app: [iOS] replace ViewEvent.View with add ViewController field For mixing native UI with Gio UI, the UIViewController is sometimes needed, not just the UIView. This change replace the View field of ViewEvent with ViewController. Signed-off-by: Inkeliz --- app/os_ios.go | 8 ++++---- app/os_ios.m | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/os_ios.go b/app/os_ios.go index cb18f53f..f6f6dea6 100644 --- a/app/os_ios.go +++ b/app/os_ios.go @@ -87,8 +87,8 @@ import ( ) type ViewEvent struct { - // View is a CFTypeRef for the UIView backing a Window. - View uintptr + // ViewController is a CFTypeRef for the UIViewController backing a Window. + ViewController uintptr } type window struct { @@ -112,7 +112,7 @@ func init() { } //export onCreate -func onCreate(view C.CFTypeRef) { +func onCreate(view, controller C.CFTypeRef) { w := &window{ view: view, } @@ -128,7 +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)}) + w.w.Event(ViewEvent{ViewController: uintptr(controller)}) } //export gio_onDraw diff --git a/app/os_ios.m b/app/os_ios.m index df9cc08e..94f254bc 100644 --- a/app/os_ios.m +++ b/app/os_ios.m @@ -30,7 +30,7 @@ CGFloat _keyboardHeight; #endif drawView.preservesSuperviewLayoutMargins = YES; drawView.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0); - onCreate((__bridge CFTypeRef)drawView); + onCreate((__bridge CFTypeRef)drawView, (__bridge CFTypeRef)self); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChange:) name:UIKeyboardWillShowNotification